title: gps location xamarin android not working
body: <ul>
  <li>In list viewList item get the gps location using this code segment but it is not working(<code>public class ItemGeoLocationActivity : ListActivity, ILocationListener the class</code>)</li>
  </ul>
  
  <p>Please look at it what I did wrong.</p>
  
  <pre><code>[Activity(Label = "ItemGeoLocationActivity")]
  public class ItemGeoLocationActivity : ListActivity, ILocationListener
  {
  LocationManager _locMgr;
          private string Latitude;
          private string Longitude;
          protected override void OnCreate(Bundle bundle)
          {
              base.OnCreate(bundle);
              _locMgr = GetSystemService(Context.LocationService) as LocationManager;
              list = new ItemGeoLocationAdapter(this);
              this.ListAdapter = list;
          }
  
          protected override void OnListItemClick(ListView l, View v, int position, long id)
          {
              var item = this.list.GetItemAtPosition(position);
  
              var builder = new AlertDialog.Builder(this);
              builder.SetMessage(item.ItemName + "-- Latitude ="+Latitude+" Longitude="+Longitude);
              builder.SetPositiveButton("OK", (s, e) =&gt;
              {
                  var itemGeoLocation =new ItemGeoLocation
                  {
                      ItemId = item.ItemId,
                      Langtitued = Convert.ToDecimal(Longitude),
                      Latitued = Convert.ToDecimal(Latitude)
                  };
                  new DataAccess().AddItemGeoLocation(itemGeoLocation);
                  Toast.MakeText(this, item.ItemName + "-- Recode Added Succesafully", ToastLength.Long).Show(); 
  
              });
              builder.SetNegativeButton("Cancel", (s, e) =&gt;
              {
                  Toast.MakeText(this, item.ItemName + " Save Cancelation Success!", ToastLength.Long).Show(); 
  
              });
              builder.Create().Show();
  
          }
  
          protected override void OnResume()
          {
              base.OnResume();
              var locationCriteria = new Criteria();
              locationCriteria.Accuracy = Accuracy.NoRequirement;
              locationCriteria.PowerRequirement = Power.NoRequirement;
              string locationProvider = _locMgr.GetBestProvider(locationCriteria, true);
              _locMgr.RequestLocationUpdates(locationProvider, 2000, 1, this);
          }
  
          protected override void OnPause()
          {
              base.OnPause();
              _locMgr.RemoveUpdates(this);
          }
  
          #region ILocationListener implementation
          public void OnLocationChanged(Location location)
          {
              Latitude = location.Latitude.ToString();
              Longitude=location.Longitude.ToString();
          }
  
          public void OnProviderDisabled(string provider)
          {
          }
  
          public void OnProviderEnabled(string provider)
          {
          }
  
          public void OnStatusChanged(string provider, Availability status, Bundle extras)
          {
          }
  </code></pre>
  
  <p>}</p>