地图视图中的 ontapp() 方法
我是android新手,在地图视图中工作,我想通过点击一个位置来获取位置,从地图上获取logi/lati,Google带我到这个方法 **protected boolean onTapp(GeoPoint p, MapView map) {
if(Map == null) {
Map = map;
}
Geocoder coder = new Geocoder(this.mContext,Locale.getDefault());
try {
List<Address> aList = coder.getFromLocation(p.getLatitudeE6()/1e6, p.getLongitudeE6()/1e6, 5);
if(aList.size() > 0) {
int i = 0;
String address = "";
while(aList.get(0).getAddressLine(i) != null) {
address+=aList.get(0).getAddressLine(i) + " ";
i++;
}
}
}
catch (IOException e) {
e.printStackTrace();
}
return true;**
我已将其添加到 ItemizedOverlay 上,几乎没有什么变化,但它不起作用,任何人都可以帮助我或分享一些它的工作示例。
im new in android and working in map view i want to get location,s logi/lati from map by tapping on a location , Google take me to this method
**protected boolean onTapp(GeoPoint p, MapView map) {
if(Map == null) {
Map = map;
}
Geocoder coder = new Geocoder(this.mContext,Locale.getDefault());
try {
List<Address> aList = coder.getFromLocation(p.getLatitudeE6()/1e6, p.getLongitudeE6()/1e6, 5);
if(aList.size() > 0) {
int i = 0;
String address = "";
while(aList.get(0).getAddressLine(i) != null) {
address+=aList.get(0).getAddressLine(i) + " ";
i++;
}
}
}
catch (IOException e) {
e.printStackTrace();
}
return true;**
i have Add this on ItemizedOverlay with little change but its not working can any one will please help me or share some working example of it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这会做...
aList = geocoder.getFromLocation(pt.getLatitudeE6()/1E6, pt.getLongitudeE6()/1E6, 1);
this will do...
aList = geocoder.getFromLocation(pt.getLatitudeE6()/1E6, pt.getLongitudeE6()/1E6, 1);