public void onCrimeSelected(Crime crime) { if (FindViewById(Resource.Id.detailFragmentContainer) == null) { // Start an instance of CrimePagerActivity var i = new Intent(this, typeof(CrimePagerActivity)); i.PutExtra(CrimeFragment.EXTRA_CRIME_ID, crime.Id.ToString()); StartActivity(i); } else { var fm = SupportFragmentManager; var ft = fm.BeginTransaction(); var oldDetail = fm.FindFragmentById(Resource.Id.detailFragmentContainer); var newDetail = CrimeFragment.NewInstance(crime.Id); if (oldDetail != null) { ft.Remove(oldDetail); } ft.Add(Resource.Id.detailFragmentContainer, newDetail); ft.Commit(); } }
public static CrimeFragment NewInstance(Guid crimeId) { Bundle args = new Bundle(); args.PutString(EXTRA_CRIME_ID, crimeId.ToString()); var fragment = new CrimeFragment(); fragment.Arguments = args; return(fragment); }
public override Android.Support.V4.App.Fragment GetItem(int position) { var crime = Crimes[position]; return(CrimeFragment.NewInstance(crime.Id)); }