2014-04-15 33 views
0

我的问题是我有一个不断变化的地理点,我想从我的常量地理点找到位于500米半径 以下的位置。我们可以找到这些位置并保存在SharedPreferences中。如何在地图上放置指针?

回答

0

你的问题很模糊,但我会尽力帮助你。

如果您使用的地图V2这是添加标记的一种方法:

myMap.addMarker(new MarkerOptions() 
       .position(mGeoPoint) 
       .icon(BitmapDescriptorFactory 
         .fromResource(R.drawable.yourmarkericon))); 

哪里MYMAP是你的地图V2和GeoPoint的应该是一个经纬度值:

double latitude = 2.344343; 
double longitude = 45.203922; 
mGeoPoint = new LatLng (latitude, longitude); 

要保存您可以使用的共享偏好中的地理位置:

SharedPreferences myPrefs = getSharedPreferences(MyPrefs, Context.MODE_PRIVATE); 
Editor editor = myPrefs.edit(); 
editor.putLong("GeoPoint_LAT", (long) latitude); 
editor.putLong("GeoPoint_LNG", (long) longitude); 
editor.commit(); 

希望它有帮助。