Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Resources; import android.text.TextUtils; public class Main { public static int getFacialIdentifier(Context context, String type) { if (TextUtils.isEmpty(type)) { return -1; } Resources res = context.getResources(); int resId = res.getIdentifier(String.format("like_%s", type), "drawable", context.getPackageName()); return resId; } }