With below method I can pass any class and I can get values of the list.
public static void GetFieldName(ArrayList<Object> object)
throws IllegalArgumentException, IllegalAccessException {
for (Object obj : object)
for (Field field : obj.getClass().getDeclaredFields()) {
Log.i("Field", field.getName() + ":" + field.get(obj));
}
}
Suppose I have two classes Student and Employee. I don't know how many fields are there in both of them. Still I can get value of every field using the above method.
Now, I want to check if a particular class has any ArrayList within, i.e Suppose the Student class has an Arraylist<Address> of Address class. So can I get the array list values?