dimanche 22 novembre 2015

Cast field via reflection to array type in Java

I want to get private field of array of TextView via reflection, but I need to cast this field back to the array.

Field f= FieldUtils.getDeclaredField(ContentAdapter.ViewHolder.class, "button_massive", true);

Explicit cast like this TextView[] f1 = ((TextView[]) f) don't work.

Thank you in advance!





Aucun commentaire:

Enregistrer un commentaire