Android examples for App:Assets Image
set Asset Image
//package com.java2s; import java.io.IOException; import java.io.InputStream; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.widget.ImageView; public class Main { public static boolean setAssetImage(ImageView imageView, String filename) { return setAssetImage(imageView, null, filename); }// w w w .j a va 2s .co m public static boolean setAssetImage(ImageView imageView, String path, String filename) { if (filename == null || "".equals(filename) || "NULL".equalsIgnoreCase(filename)) { return false; } String _path = (path == null) ? "" : path; InputStream is = null; try { is = imageView.getContext().getAssets().open(_path + filename); } catch (IOException e) { throw new RuntimeException(e); } Bitmap bitmap = BitmapFactory.decodeStream(is); imageView.setImageBitmap(bitmap); return true; } }