Android examples for App:Resource
get String Resource from Context
//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);//from w w w . j ava2 s . co m if (resId != 0) return context.getResources().getString(resId); else return defaultValue; } }