コード例 #1
0
        protected void GetLocationClicked(object sender, EventArgs e)
        {
            Criteria criteria = new Criteria();

            criteria.Accuracy         = Accuracy.NoRequirement;
            criteria.PowerRequirement = Power.NoRequirement;
            locMgr.RequestSingleUpdate(criteria, this, null);

            FragmentTransaction ft = FragmentManager.BeginTransaction();
            var dialogFragment     = new ProgressDialogFragment();

            dialogFragment.Show(ft, "progress_dialog");
        }
コード例 #2
0
        public void OnLocationChanged(Location location)
        {
            // Remove progress dialog fragment
            FragmentTransaction    ft             = FragmentManager.BeginTransaction();
            ProgressDialogFragment dialogFragment = (ProgressDialogFragment)FragmentManager.FindFragmentByTag("progress_dialog");

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

            _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());
            }
        }