protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var index = Intent.Extras.GetInt("current_play_id", 0); Fragment details = new InfoFragment(); switch(index) { case 0: details = new InfoFragment(); break; case 1: details = new AddOverviewFragment(); break; case 2: details = new AddFragment(); break; case 3: details = new SignFragment(); break; } var fragmentTransaction = FragmentManager.BeginTransaction(); fragmentTransaction.Replace(Android.Resource.Id.Content, details); fragmentTransaction.Commit(); }
private void ShowDetails(int menuId) { _currentPlayId = menuId; if (_isDualPane) { // We can display everything in-place with fragments. // Have the list highlight this item and show the data. ListView.SetItemChecked(menuId, true); Fragment details = new InfoFragment(); switch(menuId) { case 0: details = new InfoFragment(); break; case 1: details = new AddOverviewFragment(); break; case 2: details = new AddFragment(); break; case 3: details = new SignFragment(); break; } // Check what fragment is shown, replace if needed. var ft = FragmentManager.BeginTransaction(); ft.Replace(Resource.Id.details, details); ft.SetTransition(FragmentTransit.FragmentFade); ft.Commit(); } else { // Otherwise we need to launch a new activity to display // the dialog fragment with selected text. var intent = new Intent(); intent.SetClass(Activity, typeof(DetailsActivity)); intent.PutExtra("current_play_id", menuId); StartActivity(intent); } }