protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape) { Finish(); } var songId = Intent.Extras.GetInt("current_song_id", 0); var detailsFrag = SongsFragment.NewInstance(songId); SupportFragmentManager.BeginTransaction() .Add(Android.Resource.Id.Content, detailsFrag) .Commit(); }
void ShowPlayQuote(int songId) { if (showingTwoFragments) { ListView.SetItemChecked(songId, true); SongsFragment songsFragment; try { songsFragment = FragmentManager.FindFragment(Activity.FindViewById(Resource.Id.songs_container)) as SongsFragment; } catch (Exception e) { songsFragment = null; Log.Debug("Songs Fragment: ", e.Message); } if (songsFragment == null || songsFragment.songsId != songId) { var quoteFrag = SongsFragment.NewInstance(songId); FragmentTransaction ft = Activity.SupportFragmentManager.BeginTransaction(); ft.Replace(Resource.Id.songs_container, quoteFrag); ft.AddToBackStack(null); ft.SetTransition((int)Android.App.FragmentTransit.FragmentFade); ft.Commit(); } } else { var intent = new Intent(Activity, typeof(SongsActivity)); intent.PutExtra("current_song_id", songId); StartActivity(intent); } }