get class Declared Field - Android java.lang.reflect

Android examples for java.lang.reflect:Field

Description

get class Declared Field

Demo Code


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

public class Main {
    public static Field getDeclaredField(Class clazz, String name) {
        try {/*www  .j  a  va 2s. com*/
            return clazz.getDeclaredField(name);
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related Tutorials