Android examples for java.lang.reflect:Field
set Reflect Field
//package com.java2s; import java.lang.reflect.Field; public class Main { public static void setReflectField(Object obj, String field, Object value) {/*from ww w. j ava 2 s .com*/ try { Field f = null; try { f = obj.getClass().getDeclaredField(field); } catch (Exception e) { f = obj.getClass().getField(field); } f.setAccessible(true); f.set(obj, value); } catch (Exception e) { } } }