2

嗨,我需要将 android 应用程序转换为黑莓 (apk2bar)。问题是,当我尝试转换时,我收到“部署失败”错误,因为我的应用程序包含黑莓不支持的谷歌地图库。

谁能指导我实现从 apk2bar 转换后将在黑莓上运行的谷歌地图。

编辑:我的应用程序包含 GeoPoint 类以从“com.google.android.maps”获取当前纬度,这是谷歌地图使用但不支持 BB 的库。所以请指导我在 android 应用程序中替换 GeoPoint 类。

4

2 回答 2

2

您可以使用基于 Web 的方法解决此问题。请在此处阅读:http:
//developer.blackberry.com/android/apisupport/apisupport_mapping_support.html

于 2012-12-10T14:12:50.407 回答
0

您可以通过以下方式在您的应用程序中创建谷歌地图”

String initial = "<!DOCTYPE html>\r\n" + 
    "<html> \r\n" + 
    "<head> \r\n" + 
    " <meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\" /> \r\n" + 
    " <title>Google Maps Multiple Markers</title> \r\n" + 
    " <script src=\"http://maps.google.com/maps/api/js?sensor=false\" \r\n" + 
    " type=\"text/javascript\"></script>\r\n" + 
    "</head> \r\n" + 
    "<body>\r\n" + 
    " <div id=\"map\" style=\"width: 360px; height: 390px;\"></div>\r\n" + 
    "\r\n" + 
    " <script type=\"text/javascript\">\r\n" + 
    " var locations = ["; 
    String second= " ];\r\n" + 
    "\r\n" + 
    " var map = new google.maps.Map(document.getElementById('map'), {\r\n" + 
    " zoom: 8,"; 
    String centerPoint =""; 
    String finalpart = " mapTypeId: google.maps.MapTypeId.ROADMAP\r\n" + 
    " });\r\n" + 
    "\r\n" + 
    " var infowindow = new google.maps.InfoWindow();\r\n" + 
    "\r\n" + 
    " var marker, i;\r\n" + 
    "\r\n" + 
    " for (i = 0; i < locations.length; i++) { \r\n" + 
    " marker = new google.maps.Marker({\r\n" + 
    " position: new google.maps.LatLng(locations[i][1], locations[i][2]),\r\n" + 
    " map: map\r\n" + 
    " });\r\n" + 
    "\r\n" + 
    " google.maps.event.addListener(marker, 'click', (function(marker, i) {\r\n" + 
    " return function() {\r\n" + 
    " infowindow.setContent(locations[i][0]);\r\n" + 
    " infowindow.open(map, marker);\r\n" + 
    " }\r\n" + 
    " })(marker, i));\r\n" + 
    " }\r\n" + 
    " </script>\r\n" + 
    "</body>\r\n" + 
    "</html>";

然后在您的构造函数中执行以下操作:

String[] lt={x}; 
                   String[] lon={y};
                   String[] name={"CurrentLocation"};
                StringBuffer html=new StringBuffer(); 
                html.append(initial); 
                for(int i=0 ; i<lt.length; i++){ 
                //LocationObj source = (LocationObj)waypoints.elementAt(i); 
                //String point = "['"+source.getLabel()+"',"+source.getLatitude()+","+ source.getLongitude()+","+i+"],"; 
                String point = "['"+name[i]+"',"+lt[i]+","+ lon[i]+","+i+"],"; 
                //System.out.println("Point is"+point); 
                html.append(point); 
                } 
                html.append(second); 
                centerPoint = " center: new google.maps.LatLng("+lt[0]+","+lon[0]+"),"; 
                html.append(centerPoint); 
                html.append(finalpart); 
                //System.out.println("Plot is"+html.toString()); 
                BrowserFieldConfig _bfConfig = new BrowserFieldConfig(); 
                _bfConfig.setProperty(BrowserFieldConfig.NAVIGATION_MODE,BrowserFieldConfig.NAVIGATION_MODE_POINTER); 
                _bfConfig.setProperty( BrowserFieldConfig.JAVASCRIPT_ENABLED, Boolean.TRUE ); 
                _bfConfig.setProperty(BrowserFieldConfig.USER_AGENT, "MyApplication 1.0"); 

                BrowserField myBrowserField = new BrowserField(_bfConfig); 

                myBrowserField.displayContent(html.toString(), ""); 

在 vfm 或 hfm 中添加 myBrowserField 以显示在屏幕上。x & y 是纬度和经度值(分别)。希望这可以帮助!

于 2012-12-05T12:23:34.217 回答