Beispiel #1
0
        public void OnCrimeSelected(Crime crime)
        {
            if (FindViewById(Resource.Id.detailFragmentContainter) == null)
            {
                // Start an instance of CrimePagerActivity
                Intent i = new Intent(this, typeof(CrimePagerActivity));
                i.PutExtra(CrimeFragment.EXTRA_CRIME_ID, crime.Id);
                StartActivity(i);
            }
            else
            {
                Android.Support.V4.App.FragmentManager     fm = SupportFragmentManager;
                Android.Support.V4.App.FragmentTransaction ft = fm.BeginTransaction();

                Android.Support.V4.App.Fragment oldDetail = fm.FindFragmentById(Resource.Id.detailFragmentContainter);
                Android.Support.V4.App.Fragment newDetail = CrimeFragment.NewInstance(crime.Id);

                if (oldDetail != null)
                {
                    ft.Remove(oldDetail);
                }

                ft.Add(Resource.Id.detailFragmentContainter, newDetail);
                ft.Commit();
            }
        }
Beispiel #2
0
        public static CrimeFragment NewInstance(string guid)
        {
            Bundle args = new Bundle();

            args.PutString(EXTRA_CRIME_ID, guid);

            CrimeFragment fragment = new CrimeFragment();

            fragment.Arguments = args;

            return(fragment);
        }
        public override Android.Support.V4.App.Fragment GetItem(int position)
        {
            Crime crime = CONTENT[position];

            return(CrimeFragment.NewInstance(crime.Id));
        }
Beispiel #4
0
        public static CrimeFragment NewInstance(string guid)
        {
            Bundle args = new Bundle();
            args.PutString(EXTRA_CRIME_ID, guid);

            CrimeFragment fragment = new CrimeFragment();
            fragment.Arguments = args;

            return fragment;
        }