Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; public class Main { /** * helper class to retrieve a string by it's resource name * * @param ctx * @param resourceName * @return */ private static String getStringResourceByName(Context ctx, String resourceName) { String packageName = ctx.getPackageName(); int resId = ctx.getResources().getIdentifier(resourceName, "string", packageName); if (resId == 0) { return ""; } else { return ctx.getString(resId); } } }