protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_detail); Bundle arguments = new Bundle(); arguments.PutParcelable(DetailFragment.DetailUri, Intent.Data); var fragment = new DetailFragment(); fragment.Arguments = arguments; if (savedInstanceState == null) { SupportFragmentManager.BeginTransaction() .Add(Resource.Id.weather_detail_container, fragment) .Commit(); } }
public void OnItemSelected(Android.Net.Uri contentUri) { if (_twoPane) { // In two-pane mode, show the detail view in this activity by // adding or replacing the detail fragment using a // fragment transaction. var args = new Bundle(); args.PutParcelable(DetailFragment.DetailUri, contentUri); var fragment = new DetailFragment(); fragment.Arguments = args; SupportFragmentManager.BeginTransaction().Replace(Resource.Id.weather_detail_container, fragment, DetailFragmentTag).Commit(); } else { var intent = new Intent(this, typeof(DetailActivity)); intent.SetData(contentUri); StartActivity(intent); } }