我希望每当我的当前位置发生变化时,标记位置也会更新,并且它会显示在地图中的下一个新位置。?
答案 0 :(得分:2)
您需要实施LocationListener并更新MapView
回调中的onLocationChanged
abstract void onLocationChanged(Location location)
当位置发生变化时调用。
开发指南中有一个主题:http://developer.android.com/guide/topics/location/obtaining-user-location.html
答案 1 :(得分:2)
您只需使用MyLocationOverlay:http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MyLocationOverlay.html
无需收听GPS,因为MyLocationOverlay会自动管理。
答案 2 :(得分:1)
对于LocationManager类:
要获得一次更新,您可以使用getLastKnownLocation(String)
或requestLocationUpdates(long minTime,float minDistance,Criteria criteria,PendingIntent intent)如果你想要定期更新。
如果您没有使用LocationManager,请指明您要执行的操作:)
希望它有效,祝你好运!