如果我将 this
添加为 LocationListener 两次,如下所示
manager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,0,3,this);
manager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,3,this);
,如下所示只删除一次this
就够了吗
manager.removeUpdates(this);
最佳答案
是的,删除 manager.removeUpdates(this);
就足够了。作为documentation说:
使用给定的 LocationListener 删除当前 Activity 的位置更新的任何当前注册。在此调用之后,此监听器将不再发生更新。
关于android - 如何从在 android 中添加两次的 LocationManager 中删除 LocationListener?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4485546/