Here you can find the source of loadImageFromAsset(Context context, String id)
static public Drawable loadImageFromAsset(Context context, String id)
//package com.java2s; import java.io.IOException; import java.io.InputStream; import android.content.Context; import android.content.res.AssetManager; import android.content.res.Resources; import android.graphics.drawable.Drawable; public class Main { static public Drawable loadImageFromAsset(Context context, String id) { try {//from www. j a v a2 s . co m Resources resources = context.getResources(); AssetManager am = resources.getAssets(); InputStream ims = am.open(id + ".png"); Drawable d = Drawable.createFromStream(ims, null); return d; } catch (IOException ex) { return null; } } }