Skip to content

Instantly share code, notes, and snippets.

@espritm
Last active March 22, 2017 17:06
Show Gist options
  • Save espritm/ca09e73f1c334373fff3f546fd5a47e9 to your computer and use it in GitHub Desktop.
Save espritm/ca09e73f1c334373fff3f546fd5a47e9 to your computer and use it in GitHub Desktop.
public override bool OnCreateOptionsMenu(Android.Views.IMenu menu)
{
MenuInflater.Inflate(Resource.Menu.top_menus, menu);
return base.OnCreateOptionsMenu(menu);
}
public override bool OnOptionsItemSelected(IMenuItem item)
{
switch (item.ItemId)
{
case Resource.Id.share:
Intent sendShareIntent = new Intent(Intent.ActionSend)
.SetType("text/plain")
.PutExtra(Intent.ExtraText, "www.maximeesprit.com");
StartActivity(sendShareIntent);
break;
case Resource.Id.moreoption:
if (SupportActionBar.Title == Resources.GetString(Resource.String.titleRenamed))
SupportActionBar.Title = Resources.GetString(Resource.String.titleBase);
else
SupportActionBar.Title = Resources.GetString(Resource.String.titleRenamed);
break;
}
return base.OnOptionsItemSelected(item);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment