【发布时间】:2012-04-16 22:14:34
【问题描述】:
听到的是我的project
在我的项目中,我正在显示我当前的位置,显示当前的经纬度。但我不能 标记我在 android 中的当前位置。
提前谢谢。
@Override
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
Log.d(TAG, "onLocationChanged with location " + location.toString());
// Displays lat, long, altitude and bearing
String text = String.format("Lat:\t %f\nLong:\t %f\nAlt:\t %f\nBearing:\t %f", location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getBearing());
this.locationText.setText(text);
try {
// This gets a list of addresses
List<Address> addresses = geocoder.getFromLocation(location.getLatitude(),
location.getLongitude(), 10);
for (Address address : addresses) {
this.locationText.append("\n" + "kaushik");
}
// Convert latitude and longitude into int that the GeoPoint constructor can understand
int latitude = (int)(location.getLatitude() * 1000000);
int longitude = (int)(location.getLongitude() * 1000000);
point = new GeoPoint(latitude,longitude);
mapController.animateTo(point);
mapController.setZoom(16);
MapOverlay mapOverLay=new MapOverlay();
mapOverLay.setPointToDraw(point);
List<Overlay> listOfOverlays=map.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverLay);
map.invalidate();
} catch (IOException e) {
Log.e("LocateMe", "Could not get Geocoder data", e);
}
}
【问题讨论】:
-
粘贴您的代码,以便我们进行更改
-
@Agarwal 我已经上传了我的项目。
-
如果能把你的sinppet粘贴到这里就更好了,以后也可以全部使用给其他人
-
@kaushik -- 你能解释一下我下载了你的项目,但找不到关于当前位置的任何信息
-
我的意思是,我正在显示当前的经纬度。使用此功能。现在我想将我的图像放在经纬度指向的位置上。
标签: android google-maps gsp