示例#1
0
        private void ItemSearch_clicked(object sender, AdapterView.ItemClickEventArgs e, Activity currentActivity)
        {
            androidGridView.ItemClick -= (sndr, argus) => ItemSearch_clicked(sndr, argus, currentActivity);

            try
            {
                Bundle utilBundle = new Bundle();
                utilBundle.PutString("siteparam", gridProductActivityCode[e.Position]);
                utilBundle.PutString("siteparamdate", dtstate);
                ActivitydetailsFragment objFragment = new ActivitydetailsFragment();
                objFragment.Arguments = utilBundle;
                Android.Support.V4.App.FragmentTransaction tx = FragmentManager.BeginTransaction();
                tx.Replace(Resource.Id.m_main, objFragment, Constants.activitydetail);
                tx.Commit();
            }
            catch (Exception ex)
            {
                currentActivity.RunOnUiThread(() =>
                {
                    Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(currentActivity);
                    alertDiag.SetTitle(Resource.String.DialogHeaderError);
                    alertDiag.SetMessage(ex.Message);
                    alertDiag.SetIcon(Resource.Drawable.alert);
                    alertDiag.SetPositiveButton(Resource.String.DialogButtonOk, (senderAlert, args) =>
                    {
                        androidGridView.ItemClick += (sndr, argus) => ItemSearch_clicked(sndr, argus, currentActivity);
                    });
                    Dialog diag = alertDiag.Create();
                    diag.Show();
                    diag.SetCanceledOnTouchOutside(false);
                });
            }
        }
        public static Android.Support.V4.App.Fragment newInstance(Context context)
        {
            ActivitydetailsFragment busrouteFragment = new ActivitydetailsFragment();

            return(busrouteFragment);
        }