Android examples for App:Resource
get Xml Id from resource
import java.lang.reflect.Field; import android.content.Context; import android.util.Log; public class Main{ public static int getXmlId(Context ctx, String resName) { Integer id = ctx.getResources().getIdentifier(resName, "xml", ctx.getPackageName());//from w w w . java2 s. c o m return id; } private static String getPackageName() { return ctx.getPackageName(); //return "com.lostad.app"; } }