Android examples for App:Resource
get Layout Id from res
import java.lang.reflect.Field; import android.content.Context; import android.util.Log; public class Main{ public static int getLayoutId(Context ctx, String layoutName) { Integer id = ctx.getResources().getIdentifier(layoutName, "layout", ctx.getPackageName());/*from w ww . j a va 2s . c o m*/ return id; } private static String getPackageName() { return ctx.getPackageName(); //return "com.lostad.app"; } }