Load an image from assets folder
Checkout this code . IN this tutorial you can find how to load image from asset folder.
// load image
try
{
// get input stream
InputStream ims = getAssets().open("avatar.jpg");
// load image as Drawable
Drawable d = Drawable.createFromStream(ims, null);
// set image to ImageView
mImage.setImageDrawable(d);
ims .close();
}
catch(IOException ex)
{
return;
}
Here you are,
public Bitmap getBitmapFromAssets(String fileName) throws IOException {
AssetManager assetManager = getAssets();
InputStream istr = assetManager.open(fileName);
Bitmap bitmap = BitmapFactory.decodeStream(istr);
istr.close();
return bitmap;
}