Android examples for App:Assets Image
load Image from Asset and return Drawable
//package com.java2s; import java.io.IOException; import java.io.InputStream; import android.content.res.AssetManager; import android.graphics.drawable.Drawable; public class Main { public static Drawable loadImage(String name, AssetManager assetManager) { try {//www. j a v a 2 s .c o m InputStream ims = assetManager.open(name); return Drawable.createFromStream(ims, null); } catch (IOException ex) { //throw new RuntimeException( "Image " + name + " could not be loaded" ); return null; } } }