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