我正在实施的应用程序涉及在黑莓中的谷歌地图中显示多个位置...
任何人都可以给我一个暗示吗???
答案 0 :(得分:1)
要在Google地图上实现多个位置,首先需要创建一个kml文件 例如: -
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Placemark>
<name>Ottawa</name>
<description>Ottawa office</description>
<Point>
<coordinates>-90.86948943473118,48.25450093195546,0</coordinates>
</Point>
</Placemark>
<Placemark>
<name>Battel Creek</name>
<description>Battel Creek</description>
<Point>
<coordinates>-85.1220703125,42.35042512243457,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>
将此文件保存在服务器上(扩展名应为KML)并在下面的代码中设置该路径: -
public void invokeGMaps() {
int mh = CodeModuleManager.getModuleHandle("GoogleMaps");
if (mh == 0) {
try {
throw new ApplicationManagerException(
"GoogleMaps isn't installed");
} catch (ApplicationManagerException e) {
System.out.println(e.getMessage());
}
}
String[] args = { };//PUT THE SAVED FILE URL OVER HERE IN DOUBLE QUOTES
ApplicationDescriptor ad = CodeModuleManager
.getApplicationDescriptors(mh)[0];
ApplicationDescriptor ad2 = new ApplicationDescriptor(ad, args);
try {
ApplicationManager.getApplicationManager()
.runApplication(ad2, true);
} catch (ApplicationManagerException e) {
System.out.println(e.getMessage());
}
}
您需要在实施这些代码之前安装谷歌地图。您可以从此处下载谷歌地图: - m.google.com/maps