예제 #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();
            }
        }
예제 #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);
        }
예제 #3
0
        public override Android.Support.V4.App.Fragment GetItem(int position)
        {
            Crime crime = CONTENT[position];

            return(CrimeFragment.NewInstance(crime.Id));
        }
예제 #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;
        }