开发者

How to remove a LocationListener from LocationManager that is added twice in android?

If I add this as a LocationListener twice as follows

manager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,0,3,this);
manager.requestLocationUpdates开发者_JAVA百科(LocationManager.GPS_PROVIDER,0,3,this);

, would it be enough to just remove this once as follows

manager.removeUpdates(this);


Yes, removing manager.removeUpdates(this); is enough. As the documentation says:

Removes any current registration for location updates of the current activity with the given LocationListener. Following this call, updates will no longer occur for this listener.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜