嗨,我正在尝试在Android上解析一些原始XML数据,然后我想在地图上绘制地震,但是首先,我无法显示lat和Lon。...其次,我不知道要在上面绘制此地震android中的Google地图
这是我的一些代码
[// extract the text between <link> and </link>
links.add(xpp.nextText());
}
}
else if(xpp.getName().equalsIgnoreCase("geo:lat")){
if(insideItem){
//extract the text between <geo:lat> and </geo:lat>
lat.add(Double.valueOf(xpp.nextText()));
}
}
else if(xpp.getName().equalsIgnoreCase("geo:long")){
if(insideItem) {
//extract the text between <geo:lat> and </geo:lat>
lon.add(Double.valueOf(xpp.nextText()));;
} }
}
//if we are at an END_TAG and the END_TAG is called "item"
else if (eventType == XmlPullParser.END_TAG && xpp.getName().equalsIgnoreCase("item"))][1]
答案 0 :(得分:0)
要将geo:lat和geo:long坐标集成到Google Maps中,您可以在URI解析器(而不是XML解析器)中输入任何坐标,如下所示:
Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
if (mapIntent.resolveActivity(getPackageManager()) != null) {
startActivity(mapIntent);
}
此特定示例用于显示旧金山。