/// <summary> /// Handle click events on options menu /// </summary> /// <param name="item"></param> /// <returns></returns> public override bool OnOptionsItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.action_Lang) { //Toggle Languages LanguagePrefs prefs = new LanguagePrefs(this); if (prefs.GetLanguageCode() == "el") { prefs.SetLanguageCode("en"); } else { prefs.SetLanguageCode("el"); } langChanged = true; //And recreate the app for changes to take effect this.Recreate(); return(true); } else if (id == Resource.Id.action_Info) { Android.Support.V7.App.AlertDialog info = new Android.Support.V7.App.AlertDialog.Builder(this) .SetTitle(Resource.String.InfoTitle) .SetMessage(Resource.String.InfoMessage).SetPositiveButton(Resource.String.OK, (object o, DialogClickEventArgs args) => { }).Show(); } return(base.OnOptionsItemSelected(item)); }
//Set the shared prefs to remember the current language private static void PersistLanguage(Context c, string language) { LanguagePrefs prefs = new LanguagePrefs(c); prefs.SetLanguageCode(language); }