public static DetailsFragment NewInstance(int playId) { var detailsFrag = new DetailsFragment { Arguments = new Bundle() }; detailsFrag.Arguments.PutInt("current_play_id", playId); return(detailsFrag); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var index = Intent.Extras.GetInt("current_play_id", 0); var details = DetailsFragment.NewInstance(index); // Details var fragmentTransaction = SupportFragmentManager.BeginTransaction(); fragmentTransaction.Add(Android.Resource.Id.Content, details); fragmentTransaction.Commit(); }
private void ShowDetails(int playId) { _currentPlayId = playId; if (_isDualPane) { // We can display everything in-place with fragments. // Have the list highlight this item and show the data. ListView.SetItemChecked(playId, true); // Check what fragment is shown, replace if needed. var details = FragmentManager.FindFragmentById(Resource.Id.details) as DetailsFragment; if (details == null || details.ShownPlayId != playId) { // Make new fragment to show this selection. details = DetailsFragment.NewInstance(playId); // Execute a transaction, replacing any existing // fragment with this one inside the frame. var ft = FragmentManager.BeginTransaction(); ft.Replace(Resource.Id.details, details); ft.SetTransition(Android.Support.V4.App.FragmentTransaction.TransitFragmentFade); 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", playId); StartActivity(intent); } // var view = inflater.Inflate(Resource.Layout.Frag3Layout, container, false); // return view; }