public override bool OnCreateOptionsMenu(ActionBar_Sherlock.View.IMenu menu) { base.OnCreateOptionsMenu (menu); var isLoggedIn = ParseUser.CurrentUser != null; var loginLogoutResourceText = isLoggedIn ? Resource.String.logoutMenuItem : Resource.String.loginMenuItem; menu.Add (0, AppConstants.LoginLogoutMenuItemId, 100, loginLogoutResourceText); return true; }
public override bool OnOptionsItemSelected(ActionBar_Sherlock.View.IMenuItem item) { switch (item.ItemId) { case AppConstants.LoginLogoutMenuItemId: _loginLogoutMenuItem = item; var menuItemText = item.TitleFormatted.ToString (); if (menuItemText.ToLower () == "login") { var intent = new Intent (this, typeof(AFA.Android.Activities.LoginActivity)); StartActivity (intent); } else { Logout (); } return true; default: return base.OnOptionsItemSelected (item); } }
public override bool OnOptionsItemSelected(ActionBar_Sherlock.View.IMenuItem item) { //if (item.TitleFormatted.ToString() == "Settings") //{ // var intent = new Intent(this, typeof(LegendActivity)); // StartActivity(intent); // return true; //} //This uses the imported MenuItem from ActionBarSherlock Intent intent; switch (item.TitleFormatted.ToString()) { case "Settings": intent = new Intent(this, typeof(LegendActivity)); StartActivity(intent); return true; case "Info": intent = new Intent(this, typeof(InfoActivity)); StartActivity(intent); return true; } return base.OnOptionsItemSelected(item); }
public override bool OnCreateOptionsMenu(ActionBar_Sherlock.View.IMenu menu) { base.OnCreateOptionsMenu(menu); SupportMenuInflater.Inflate(Resource.Menu.report_menu, menu); return true; }