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;}
If you know the filename in the code, calling this won't be a problem:
ImageView iw= (ImageView)findViewById(R.id.imageView1); int resID = getResources().getIdentifier(drawableName, "drawable", getPackageName());iw.setImageResource(resID);
Your filename will be the same name as drawableName so you won't have to deal with assets.