Java tutorial
//package com.java2s; import android.text.TextUtils; import java.lang.reflect.Field; public class Main { private static Field getField(Class<?> thisClass, String fieldName) { Field field = null; if (!TextUtils.isEmpty(fieldName)) { try { field = thisClass.getDeclaredField(fieldName); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return field; } }