get Object from Field - Android java.lang.reflect

Android examples for java.lang.reflect:Field

Description

get Object from Field

Demo Code


//package com.java2s;
import java.lang.reflect.Field;

public class Main {
    public static Object getObject(Field fld, Object instance) {
        try {//from w ww .  j ava 2  s  .c o  m
            Object obj = fld.get(instance);
            return obj;
        } catch (Exception e) {
            //if(DEBUG)
            //   Log.e(TAG,e.getMessage(), e);
            return null;
        }
    }
}

Related Tutorials