Java tutorial
//package com.java2s; import android.content.Context; public class Main { public static String getStringResource(Context context, String name, String defaultValue) { String packageName = context.getPackageName(); int resId = context.getResources().getIdentifier(name, "string", packageName); if (resId != 0) return context.getResources().getString(resId); else return defaultValue; } }