Here you can find the source of getImgFromAsserts(Context con, String filename)
public static Drawable getImgFromAsserts(Context con, String filename)
//package com.java2s; import java.io.IOException; import android.content.Context; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.widget.Toast; public class Main { public static Drawable getImgFromAsserts(Context con, String filename) { try {//w w w . ja va 2s .com return new BitmapDrawable(BitmapFactory.decodeStream(con .getAssets().open(filename))); } catch (IOException e) { Toast.makeText(con, e.toString(), Toast.LENGTH_LONG).show(); e.printStackTrace(); } return null; } }