Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

OnOptionsItemSelected is not called in fragment xamarin android

$
0
0

In OnCreate: SetHasOptionsMenu (true);

public override bool OnOptionsItemSelected(IMenuItem menu)
{
menu.SetChecked (true);
switch (menu.ItemId) {
case Resource.Id.selecta:
Toast.MakeText (Application.Context, "Top", ToastLength.Long);

            return true;
        case Resource.Id.selectb:
            Toast.MakeText (Application.Context, "New", ToastLength.Long);

            return true;
        }
        return base.OnOptionsItemSelected (menu);

    }
    public override void OnCreateOptionsMenu(Android.Views.IMenu menu,MenuInflater inflater)
    {
        //MenuInflater.Inflate (Resource.Menu.Action_menu, menu);
        //menu.Clear();
        inflater.Inflate(Resource.Menu.Action_menu,menu);

        base.OnCreateOptionsMenu (menu,inflater);
    }

When the item of checkbox is checked . OnOptionsItemSelected is not called.


Viewing all articles
Browse latest Browse all 204402

Trending Articles