Android examples for java.lang.reflect:Field
get Field from current class or parent class
//package com.java2s; import java.lang.reflect.Field; public class Main { public static Field getField(Class clazz, boolean fieldDeclaredInClass, String fieldName) throws Exception { if (fieldDeclaredInClass) return clazz.getDeclaredField(fieldName); else//from w w w . j a va2 s . com return clazz.getField(fieldName); } }