0

我有这个应用程序,它应该从经度和纬度获取地址,但是当我按下按钮调用信息时它会强制关闭。

日志错误:

10-25 14:33:51.802: ERROR/AndroidRuntime(11166):     at http.www.hotapp.com.timeandlocation.LocationManagerHelper.getAddress(LocationManagerHelper.java:51)

我的地理编码器代码

public static boolean getAddress(){
  Geocoder geoCoder = new Geocoder(context);
  try {
    geoCoder.getFromLocation(getLatitude(), getLongitude(), 0);
  } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return true;
}

logcat 错误表示该错误与new Geocoder. 请帮忙。

4

1 回答 1

1

您使用的上下文可能是错误的,它应该是调用 Activity 的上下文。

于 2011-10-26T01:58:52.283 回答