我正在尝试执行以下代码:
public void OnLocationChanged(Location location) {
var lat = (TextView)FindViewById<TextView> (Resource.Id.latitude);
var lon = (TextView)FindViewById<TextView> (Resource.Id.longitude);
var stName = (TextView)FindViewById<TextView> (Resource.Id.st_name);
lat.Text = string.Format ("Latitude: {0:N5}",location.Latitude);
lon.Text = string.Format ("Longitude: {0:N5}", location.Longitude);
try{
Geocoder geocode = new Geocoder (this);
List<Address> getAddrTask = new List<Address>(geocode.GetFromLocation(location.Latitude,location.Longitude,1));
Address returnedAddress = getAddrTask.FirstOrDefault();
if(returnedAddress != null){
System.Text.StringBuilder strReturnedAddress = new StringBuilder();
for(int i=0; i<returnedAddress.MaxAddressLineIndex;i++){
strReturnedAddress.Append(returnedAddress.GetAddressLine(i)).AppendLine(",");
}
stName.Text = strReturnedAddress.ToString();
}
}
catch(IOException e){
Toast.MakeText (this, e.Message, ToastLength.Long).Show ();
}
}
这一切都很棒而且很迷人,但是在执行它时,它给了我应用程序输出:[Choreographer] 跳过了 42 帧!应用程序可能在其主线程上做了太多工作。