【发布时间】:2012-03-26 07:42:42
【问题描述】:
从 Activity (UI) 我调用一个类来获取我的位置。 在活动的 onPause 时,我尝试停止侦听器,但状态栏中的 GPS 图标一直闪烁,在更多设备上都是这种情况(我读到这是 HTC 问题)。
谁能告诉我如何解决这个问题?
The GPS location class:
public GPSLocation (Context context) {
myContext = context;
LocatieManager=(LocationManager)myContext.getSystemService(Context.LOCATION_SERVICE);
}
public void StopLocationListeners(){
// LocationManager LocatieManager=(LocationManager)myContext.getSystemService(Context.LOCATION_SERVICE);
LocatieManager.removeUpdates(netwerklistener);
LocatieManager.removeUpdates(gpslistener);
LocatieManager.removeGpsStatusListener(gpsStatusListener);
}
在 UI 活动中,我在 onPause 方法中调用 mGPSLocation.StopLocationListeners();,但这不起作用。任何人都可以帮助我并提示为什么这是不可能的?
谢谢
【问题讨论】:
标签: android gps listener locationmanager locationlistener