예제 #1
0
        protected void GetLocationClicked(object sender, EventArgs e)
        {
            Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();
            var dialogFragment = new ProgressDialogFragment();

            dialogFragment.Show(ft, "progress_dialog");

            Criteria criteria = new Criteria();

            criteria.Accuracy         = Accuracy.NoRequirement;
            criteria.PowerRequirement = Power.NoRequirement;
            locMgr.RequestSingleUpdate(criteria, this, null);
        }
예제 #2
0
        public void OnLocationChanged(Location location)
        {
            _latEditText.Text  = location.Latitude.ToString();
            _longEditText.Text = location.Longitude.ToString();
            Geocoder        geocdr    = new Geocoder(activity);
            IList <Address> addresses = geocdr.GetFromLocation(location.Latitude, location.Longitude, 5);

            if (addresses.Any())
            {
                UpdateAddressFields(addresses.First());
            }

            Android.Support.V4.App.FragmentTransaction ft = FragmentManager.BeginTransaction();
            ProgressDialogFragment dialogFragment         =
                (ProgressDialogFragment)FragmentManager.FindFragmentByTag("progress_dialog");

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