[Mono-bugs] [Bug 675810] View android:onClick attribute throws method NoSuchMethodException

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Aug 24 14:01:10 EDT 2011


https://bugzilla.novell.com/show_bug.cgi?id=675810

https://bugzilla.novell.com/show_bug.cgi?id=675810#c4


Jonathan Pryor <jonpryor at vt.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jonpryor at vt.edu
         Resolution|                            |WONTFIX

--- Comment #4 from Jonathan Pryor <jonpryor at vt.edu> 2011-08-24 18:01:07 UTC ---
This fails because the generated Android Callable Wrapper doesn't have a
MyButton_OnClick() method, hence:

java.lang.IllegalStateException: Could not find a method MyButton_OnClick(View)
in the activity class monodroidsandbox.Activity1

A fix is to scan the IL looking for such event handlers, but I don't see that
happening. A more likely solution is for mandroid to gain support for exporting
specific methods, which is being tracked at:

http://bugzilla.xamarin.com/show_bug.cgi?id=382

For example, once this support is in place you could do:

    [Activity(Label = "MonoDroidSandbox", MainLauncher = true)]
    public class Activity1 : Activity
    {
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);
        }

        [Export]
        public void MyButton_OnClick(View view)
        {
            Log.Verbose("MonoDroidSanbox", "OnClick!");
        }
    }

Then things would Just Work.

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list