dump Field from a Class - Android java.lang.reflect

Android examples for java.lang.reflect:Field

Description

dump Field from a Class

Demo Code

import java.lang.reflect.Field;

import android.util.Log;

public class Main {
  private static final String TAG = "";

  public static void dumpField(Class clazz, String fieldName) {
    Field[] fs = clazz.getDeclaredFields();
    for (Field f : fs) {
      if (f.getName().startsWith(fieldName)) {
        Log.d(TAG, "method name: " + f.getName());
        Log.d(TAG, "]");
      }//from  w w w . j  a  v  a  2  s .  c  o m
    }
  }
}

Related Tutorials