android - In Xamarin the OnOptionsItemSelected is not called -
i read different articles here onoptionsitemselected
not been called in android, because have same problem in xamarin.android.
have menu in main activity, haven't used fragments @ all. menu read xml file:
public override bool oncreateoptionsmenu(imenu menu) { menuinflater.inflate(resource.menu.main, menu); return base.oncreateoptionsmenu(menu); }
and tried catch itemselected events using following code:
public virtual bool onoptionsitemselected (imenuitem item) { string test; console.writeline ("test"); return true; }
but doesn't work , event not called. tried other events like:
public virtual bool onmenuitemselected (int featureid, imenuitem item) { string test; console.writeline ("test"); return true; } public void ongroupitemclick( imenuitem item) { // 1 of group items (using onclick attribute) clicked // item parameter passed here indicates item // other menu item clicks handled onoptionsitemselected() int = 0; string test; console.writeline ("test"); test = item.menuinfo.tostring (); }
but none of these events have been called. menu there, cannot catch clickedevents. how can catch clickedevents?
your code seems work in clean application (just tried on xamarin.android alpha channel, latest version, on vs2013). few things might try:
- disable fast deployment in project properties under android options
- delete bin , obj folders project folder
besides this, using external library/component?
Comments
Post a Comment