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?
You can get that field from
View.class. but another mistake in your code is you tired to getListenerInfo.mOnTouchListenerfield but that's not a field. you should first getmListenerInfofield fromView.classand then getmOnTouchListenerfrom that.Try this, works fine.