I'm trying to define an onClick handler method in an XML layout for buttons in a Dialog but the app crashes when the buttons are clicked due to NoSuchMethodException (it can't find the method). The method signature is public void searchMovies(View)
and I can guarantee that it is spelled consistently in the XML file and in code. This similar question provides a solution by putting the putting the method into the Activity that the Dialog belongs to, but that doesn't work for me.
However, I'm using a FragmentActivity and FragmentStatePagerAdapter, so maybe this is the reason it doesn't work for me? I've tried putting the method into the FragmentActivity, the FragmentStatePagerAdapter, the Fragment and also the anonymous OnClickListener class that handles launching the Dialog. None of them have worked, all give NoSuchMethodException error. Again, I can guarantee that the method is spelled correctly/consistently.
I know that I can do this programmatically, but it would be much more convenient if I could do it the other way. Is it possible? Thanks.