Android examples for java.lang.reflect:Field Value
get Boolean value from Field
/**//from ww w. j a va2 s . c o m * utility functions to extract and set fields in objects using java reflection * @author Matthew * Copyright (c) 2013 Visible Automation LLC. All Rights Reserved. * */ //package com.java2s; import java.lang.reflect.Field; public class Main { public static boolean getFieldBoolean(Object o, Class c, String fieldName) throws NoSuchFieldException, IllegalAccessException { Field field = c.getDeclaredField(fieldName); field.setAccessible(true); return field.getBoolean(o); } }