Here you can find the source of getBitmapFromAsset(String strName, Context context)
public static Bitmap getBitmapFromAsset(String strName, Context context)
//package com.java2s; import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.Toast; import java.io.IOException; import java.io.InputStream; public class Main { public static Bitmap getBitmapFromAsset(String strName, Context context) { try {/* w w w . j a v a 2 s . co m*/ AssetManager assetManager = context.getAssets(); InputStream inputStream = assetManager.open(strName); return BitmapFactory.decodeStream(inputStream); } catch (IOException e) { Toast.makeText(context, "Error in filepath", Toast.LENGTH_SHORT) .show(); e.printStackTrace(); } return null; } }