Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Resources; public class Main { private static Context context; public static int getResLayoutID(String resName) { Resources res = context.getResources(); return res.getIdentifier(resName, "layout", context.getPackageName()); } }