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;
}

Leave a Comment