lundi 10 février 2020

Get OnTouchListener object from View by reflection

I need modify onTouch action on same View. So I needed in field mOnTouchListener that stored at static class ListenerInfo in public class View I try this:

Field onTouchListenerField = myView.getClass().getDeclaredField("ListenerInfo.mOnTouchListener");

and I get error: No field ListenerInfo.mOnTouchListener in class MyView; (declaration of 'MyView' appears in ...)

Why this code they found fields only in MyView class, not in base View?

Do you have any ideas?





Aucun commentaire:

Enregistrer un commentaire