public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _density = (int)Math.Ceiling(Resources.DisplayMetrics.Density);
            Instance = this;

            Bundle args = Arguments;

            if (args != null && args.ContainsKey(ArgItemId))
            {
                string key = args.GetString(ArgItemId);

                if (_item != null && key != null && !key.Equals(_item.Id))
                {
                    _barcodeImage     = null;
                    _details          = "";
                    _showResultsLabel = false;
                }

                // Load the item content specified by the fragment
                // arguments. In a real-world scenario, use a Loader
                // to load content from a content provider.
                _item = ItemListActivity._content[key];
            }
        }
            public void OnClick(View view)
            {
                ApiItem item = (ApiItem)view.Tag;

                if (_twoPane)
                {
                    Bundle arguments = new Bundle();
                    arguments.PutString(ItemDetailFragment.ArgItemId, item.Id);
                    ItemDetailFragment fragment = new ItemDetailFragment
                    {
                        Arguments = arguments
                    };
                    _parentActivity.SupportFragmentManager.BeginTransaction()
                    .Replace(Resource.Id.item_detail_container, fragment)
                    .Commit();
                }
                else
                {
                    Context context = view.Context;
                    Intent  intent  = new Intent(context, typeof(ItemDetailActivity));
                    intent.PutExtra(ItemDetailFragment.ArgItemId, item.Id);

                    context.StartActivity(intent);
                }
            }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_item_detail);
            var toolbar = FindViewById <Toolbar>(Resource.Id.detail_toolbar);

            SetSupportActionBar(toolbar);

            // Show the Up button in the action bar.
            SupportActionBar?.SetDisplayHomeAsUpEnabled(true);

            // savedInstanceState is non-null when there is fragment state
            // saved from previous configurations of this activity
            // (e.g. when rotating the screen from portrait to landscape).
            // In this case, the fragment will automatically be re-added
            // to its container so we don't need to manually add it.
            // For more information, see the Fragments API guide at:
            //
            // http://developer.android.com/guide/components/fragments.html
            //
            if (savedInstanceState == null)
            {
                // Create the detail fragment and add it to the activity
                // using a fragment transaction.
                Bundle arguments = new Bundle();
                arguments.PutString(ItemDetailFragment.ArgItemId,
                                    Intent.GetStringExtra(ItemDetailFragment.ArgItemId));
                ItemDetailFragment fragment = new ItemDetailFragment
                {
                    Arguments = arguments
                };
                SupportFragmentManager.BeginTransaction()
                .Add(Resource.Id.item_detail_container, fragment)
                .Commit();
            }
            IntentFilter filter = new IntentFilter();

            filter.AddCategory(Intent.CategoryDefault);
            filter.AddAction(Resources.GetString(Resource.String.activity_intent_filter_action));
            RegisterReceiver(_broadcastReceiver, filter);
        }