コード例 #1
0
        public override bool OnOptionsItemSelected(Android.View.IMenuItem item)
        {
            bool result = true;

            switch (item.GetItemId())
            {
            //    case android.R.id.home:
            case 1: //Android.R.Id.Home.:
                // app icon in action bar clicked; go home
                var intent = new Intent(this, typeof(MainActivity));
                intent.AddFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                StartActivity(intent);
                break;

            default:
                result = base.OnOptionsItemSelected(item);
                break;
            }

            {// remove when switch is working
                var intent = new Intent(this, typeof(MainActivity));
                intent.AddFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                StartActivity(intent);
            }
            return(result);
        }
コード例 #2
0
ファイル: MainActivity.cs プロジェクト: luozhiping1987/dot42
        public override bool OnOptionsItemSelected(Android.View.IMenuItem item)
        {
            bool result = true;

            switch (item.GetItemId())
            {
            case R.Id.menu_options:
                var intent = new Intent(this, typeof(SettingsActivity));
                StartActivityForResult(intent, 1);
                break;

            default:
                result = base.OnOptionsItemSelected(item);
                break;
            }
            return(result);
        }