protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here\
            var index = Intent.Extras.GetInt("_currentPlayId", 0);

            var details             = DetailsFragment.NewInstance(index);
            var fragmentTransaction = FragmentManager.BeginTransaction();

            fragmentTransaction.Add(Android.Resource.Id.Content, details);
            fragmentTransaction.Commit();
        }
        public static DetailsFragment NewInstance(int playId)
        {
            var detailsFragment = new DetailsFragment {
                Arguments = new Bundle()
            };

            try
            {
                detailsFragment.Arguments.PutInt("_currentPlayId", playId);
            }
            catch (Exception ex)
            {
            }
            return(detailsFragment);
        }
示例#3
0
 private void ShowDetails(int _currentPlayId)
 {
     try
     {
         if (isTabletPane)
         {
             // We can display everything in place with fragments.
             // Have the list highlight this item and show the data.
             ListView.SetItemChecked(_currentPlayId, true);
             // Check what fragment is shown, replace if needed.
             var details = FragmentManager.FindFragmentById(Resource.Id.frameLayoutDetailsFragmentOne) as DetailsFragment;
             if (details == null || details.shownPlayId != _currentPlayId)
             {
                 // Make new fragment to show this selection.
                 details = DetailsFragment.NewInstance(_currentPlayId);
                 // Execute a transaction, replacing any existing
                 // fragment with this one inside the frame.
                 var fragmentTransaction = FragmentManager.BeginTransaction();
                 fragmentTransaction.Replace(Resource.Id.frameLayoutDetailsFragmentOne, details);
                 fragmentTransaction.SetTransition(FragmentTransit.FragmentFade);
                 fragmentTransaction.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("currentPlayId", _currentPlayId);
             StartActivity(intent);
         }
     }
     catch (Exception ex)
     {
         var msg = ex.Message;
     }
 }