Android examples for Graphics:Bitmap File
decode Bitmap From Assets
//package com.book2s; import java.io.IOException; import java.io.InputStream; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; public class Main { private static Activity activity; public static Bitmap decodeBitmapFromAssets(String paramString) { BitmapFactory.Options localOptions = new BitmapFactory.Options(); localOptions.inPreferredConfig = Bitmap.Config.ARGB_8888; localOptions.inPurgeable = true; localOptions.inInputShareable = true; InputStream localInputStream2 = null; try {// www . j a va 2s.co m localInputStream2 = activity.getAssets().open(paramString); return BitmapFactory.decodeStream(localInputStream2, null, localOptions); } catch (IOException localIOException) { localIOException.printStackTrace(); } finally { try { localInputStream2.close(); } catch (IOException e) { e.printStackTrace(); } } return null; } }