Java tutorial
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.util.HashMap; import android.content.Context; import android.content.res.AssetManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Log; public class Main { private static final String TAG = "EmotionUtils"; private static final HashMap<String, String> MAP = new HashMap<String, String>(); public static Bitmap getEmotion(Context context, String key) { String fileName = "default_emotions_package/" + MAP.get(key); try { AssetManager am = context.getAssets(); return BitmapFactory.decodeStream(am.open(fileName)); } catch (IOException e) { Log.e(TAG, e.getMessage()); } return null; } }