[android-developers] android:onClick and fragments

2012-05-28 Thread Ralph Bergmann | the4thFloor.eu
Hello, In the layout of my fragment I have a ImageButton where I use the android:onClick option. But when I tap on the button I get this error: Failed to handle callback; interface not implemented, callback:android.view.View$PerformClick@410a5308 java.lang.IllegalStateException: Could not find

Re: [android-developers] android:onClick and fragments

2012-05-28 Thread Mark Murphy
On Mon, May 28, 2012 at 5:51 AM, Ralph Bergmann | the4thFloor.eu ra...@the4thfloor.eu wrote: Why the callback method must be in the FragmentActivity class and not in the Fragment class? Because android:onClick was added in Android 1.6, well before the existence of fragments, and we have not

Re: [android-developers] android:onClick and fragments

2012-05-28 Thread Dianne Hackborn
The ultimate reason is because android:onClick is implemented by looking for the method on the view's Context, which will (usually) be your Activity. Views have no concept of fragments, so there is no way for them to find a method on a fragment or know what fragment they should even be looking