Android examples for java.lang.reflect:Field
get Boolean Field
//package com.java2s; import java.lang.reflect.Field; public class Main { public static boolean getBooleanField(Class clazz, String fieldName) { boolean v = false; Field field;/*from ww w . j av a2s . c o m*/ try { field = clazz.getField(fieldName); v = field.getBoolean(clazz); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } return v; } }