Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.util.Log; public class Main { public static int getLayoutIdFromName(Context context, String type, String name) { String layoutName = type + "_" + name.replaceAll("(.)(\\p{Lu})", "$1_$2").toLowerCase(); try { return context.getResources().getIdentifier(layoutName, "layout", context.getPackageName()); } catch (Exception ex) { Log.e("Yintro", "Please create layout suggested name: " + layoutName); return -1; } } }