/**
             * Helper function to show the details of a selected item, either by
             * displaying a fragment in-place in the current UI, or starting a
             * whole new activity in which it is displayed.
             */
            void ShowDetails(int index)
            {
                curCheckPosition = index;

                if (dualPane)
                {
                    ListView.SetItemChecked(index, true);

                    var details = (DetailsFragment)FragmentManager.FindFragmentById(Resource.Id.details);
                    if (details == null || details.GetShownIndex() != index)
                    {
                        Console.WriteLine("Index = " + index);
                        details = new DetailsFragment(index);

                        var ft = FragmentManager.BeginTransaction();
                        ft.Replace(Resource.Id.details, details);
                        ft.SetTransition(FragmentTransaction.TransitFragmentFade);
                        ft.Commit();
                    }
                }
                else
                {
                    var intent = new Intent();
                    intent.SetClass(Activity, typeof(DetailsActivity));
                    intent.PutExtra("index", index);
                    StartActivity(intent);
                }
            }
            /**
             * Create a new instance of DetailsFragment, initialized to
             * show the text at 'index'.
             */
            public static DetailsFragment NewInstance(int index)
            {
                DetailsFragment f = new DetailsFragment();

                // Supply index input as an argument.
                Bundle args = new Bundle();

                args.PutInt("index", index);
                f.SetArguments(args);

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

                if (Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape)
                {
                    Finish();
                    return;
                }

                if (savedInstanceState == null)
                {
                    var details = new DetailsFragment();
                    details.Arguments = Intent.Extras;
                    SupportFragmentManager.BeginTransaction().Add(Android.Resource.Id.Content, details).Commit();
                }
            }
            protected override void OnCreate(Bundle savedInstanceState)
            {
                base.OnCreate (savedInstanceState);

                if(Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape)
                {
                    Finish();
                    return;
                }

                if(savedInstanceState == null)
                {
                    var details = new DetailsFragment();
                    details.Arguments = Intent.Extras;
                    SupportFragmentManager.BeginTransaction().Add(Android.Resource.Id.Content, details).Commit();
                }
            }
            protected override void OnCreate(Bundle savedInstanceState) {
                base.OnCreate(savedInstanceState);

                if (GetResources().GetConfiguration().Orientation
                        == Configuration.ORIENTATION_LANDSCAPE) {
                    // If the screen is now in landscape mode, we can show the
                    // dialog in-line with the list so we don't need this activity.
                    Finish();
                    return;
                }

                if (savedInstanceState == null) {
                    // During initial setup, plug in the details fragment.
                    DetailsFragment details = new DetailsFragment();
                    details.SetArguments(GetIntent().GetExtras());
                    GetSupportFragmentManager().BeginTransaction().Add(
                            global::Android.R.Id.Content, details).Commit();
                }
            }
            /**
             * Helper function to show the details of a selected item, either by
             * displaying a fragment in-place in the current UI, or starting a
             * whole new activity in which it is displayed.
             */
            void ShowDetails(int index)
            {
                mCurCheckPosition = index;

                if (mDualPane)
                {
                    // We can display everything in-place with fragments, so update
                    // the list to highlight the selected item and show the data.
                    GetListView().SetItemChecked(index, true);

                    // Check what fragment is currently shown, Replace if needed.
                    DetailsFragment details = (DetailsFragment)
                                              GetFragmentManager().FindFragmentById(R.Ids.details);
                    if (details == null || details.GetShownIndex() != index)
                    {
                        // Make new fragment to show this selection.
                        details = DetailsFragment.NewInstance(index);

                        // Execute a transaction, replacing any existing fragment
                        // with this one inside the frame.
                        FragmentTransaction ft = GetFragmentManager().BeginTransaction();
                        //if (index == 0) {
                        ft.Replace(R.Ids.details, details);

                        /*} else {
                         *  ft.Replace(R.Ids.a_item, details);
                         * }*/
                        ft.SetTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
                        ft.Commit();
                    }
                }
                else
                {
                    // Otherwise we need to launch a new activity to display
                    // the dialog fragment with selected text.
                    Intent intent = new Intent();
                    intent.SetClass(GetActivity(), typeof(DetailsActivity));
                    intent.PutExtra("index", index);
                    StartActivity(intent);
                }
            }
            protected override void OnCreate(Bundle savedInstanceState)
            {
                base.OnCreate(savedInstanceState);

                if (GetResources().GetConfiguration().Orientation
                    == Configuration.ORIENTATION_LANDSCAPE)
                {
                    // If the screen is now in landscape mode, we can show the
                    // dialog in-line with the list so we don't need this activity.
                    Finish();
                    return;
                }

                if (savedInstanceState == null)
                {
                    // During initial setup, plug in the details fragment.
                    DetailsFragment details = new DetailsFragment();
                    details.SetArguments(GetIntent().GetExtras());
                    GetSupportFragmentManager().BeginTransaction().Add(
                        global::Android.R.Id.Content, details).Commit();
                }
            }
            /**
             * Create a new instance of DetailsFragment, initialized to
             * show the text at 'index'.
             */
            public static DetailsFragment NewInstance(int index) {
                DetailsFragment f = new DetailsFragment();

                // Supply index input as an argument.
                Bundle args = new Bundle();
                args.PutInt("index", index);
                f.SetArguments(args);

                return f;
            }
            /**
             * Helper function to show the details of a selected item, either by
             * displaying a fragment in-place in the current UI, or starting a
             * whole new activity in which it is displayed.
             */
            void ShowDetails(int index)
            {
                curCheckPosition = index;

                if(dualPane)
                {
                    ListView.SetItemChecked(index, true);

                    var details = (DetailsFragment) FragmentManager.FindFragmentById(Resource.Id.details);
                    if(details == null || details.GetShownIndex() != index)
                    {
                        Console.WriteLine ("Index = " + index);
                        details = new DetailsFragment(index);

                        var ft = FragmentManager.BeginTransaction();
                        ft.Replace(Resource.Id.details, details);
                        ft.SetTransition(FragmentTransaction.TransitFragmentFade);
                        ft.Commit();
                    }
                }
                else
                {
                    var intent = new Intent();
                    intent.SetClass(Activity, typeof(DetailsActivity));
                    intent.PutExtra("index", index);
                    StartActivity(intent);
                }
            }