【发布时间】:2010-01-19 22:01:55
【问题描述】:
我如何取消订阅 LocationListener 以接收来自 LocationManager 的更新?
我是这样设置的
mLocationManager = (LocationManager)this.getSystemService(LOCATION_SERVICE);
mListener = new LocationListener() {
public void onLocationChanged(Location location) {
Log.i("LocationListener", "Logging Change");
}
}
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
5000, 1, mListener);
退出创建 LocationListener 的视图后,我仍然在 LogCat 窗口中收到日志消息。
我知道这是因为我正在孤立侦听器,但我看不到 LocationListener 上的任何销毁方法,也看不到 LocationManager 对象上的任何“删除侦听器”样式方法。
【问题讨论】:
标签: android locationmanager locationlistener