Bing地图SDK对于黑莓6.0 [英] Bing Maps SDK For Blackberry 6.0

查看:113
本文介绍了Bing地图SDK对于黑莓6.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Bing地图的应用程序正在开发黑莓打靶OS 6.0。但找不到任何可用的本地或框架SDK。请帮我使用或者冰或谷歌地图SDK的黑莓。请提供从那里我能得到SDK中的引用。谢谢你。

I need to use Bing maps in an app being developed targetting blackberry OS 6.0. But could not find any natively available framework or SDK. Please help me on using either Bing or Google Maps SDK on blackberry. Please provide the references from where I can get the SDK. Thank you.

推荐答案

下面是使用的例子谷歌地图后,不知道如何使用Bing地图。搜索结果
首先, http://m.google设备/模拟器安装谷歌地图即可。 COM /地图/敲击在设备/模拟器的浏览器这个链接。结果
然后,你可以调用从应用程序的谷歌地图应用程序。这里是一个code样品:<​​/ P>

Here is an example of using Google Maps, don't know how to use Bing maps.

First, install Google Maps on your device/simulator from http://m.google.com/maps/ by hitting this link on the browser of the device/simulator.
Then you can invoke the Google Maps application from your application. Here is a code sample:

package mypackage;

import net.rim.blackberry.api.browser.URLEncodedPostData;
import net.rim.device.api.system.ApplicationDescriptor;
import net.rim.device.api.system.ApplicationManager;
import net.rim.device.api.system.ApplicationManagerException;
import net.rim.device.api.system.CodeModuleManager;
import net.rim.device.api.ui.Field;
import net.rim.device.api.ui.FieldChangeListener;
import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.component.BasicEditField;
import net.rim.device.api.ui.component.ButtonField;
import net.rim.device.api.ui.component.Dialog;
import net.rim.device.api.ui.container.MainScreen;
import net.rim.device.api.ui.container.VerticalFieldManager;

/**
 * A class extending the MainScreen class, which provides default standard
 * behavior for BlackBerry GUI applications.
 */
public final class MyScreen extends MainScreen
{
    /**
     * Creates a new MyScreen object
     */
    public MyScreen()
    {        
        // Set the displayed title of the screen       
        setTitle("Google Maps");

        VerticalFieldManager mainManager = new VerticalFieldManager(USE_ALL_HEIGHT | USE_ALL_WIDTH);

        final BasicEditField latitudeInputField = new BasicEditField("Latitude:" , "23.717782");
        final BasicEditField longitudeInputField = new BasicEditField("Longitude:" , "90.407124");
        final BasicEditField titleInputField = new BasicEditField("Title:" , "Dhaka, Bangladesh");
        final BasicEditField descriptionInputField = new BasicEditField("Description:" , "Capital City of Bangladesh");

        ButtonField btn_ShowMap = new ButtonField("Show On Map");
        btn_ShowMap.setChangeListener(new FieldChangeListener() {

            public void fieldChanged(Field field, int context) {
                double lat = Double.parseDouble( latitudeInputField.getText() );
                double lon = Double.parseDouble( longitudeInputField.getText() );
                String title = titleInputField.getText();
                String description = descriptionInputField.getText();
                showGoogleMap(lat, lon, title, description);
            }
        });

        mainManager.add(latitudeInputField);
        mainManager.add(longitudeInputField);
        mainManager.add(titleInputField);
        mainManager.add(descriptionInputField);
        mainManager.add(btn_ShowMap);

        add(mainManager);

    }

    /**
     * Starts the Google Maps application and the specified locatin is shown on map
     * @param latitude the latitude of the location to show
     * @param longitude the longitude of the location to show
     * @param title the title of the location to show
     * @param description the description of the location to show
     */
    public void showGoogleMap(double latitude, double longitude, String title,  String description) {
        try {
            int mh = CodeModuleManager.getModuleHandle("GoogleMaps");
            if (mh == 0) {
                 throw new ApplicationManagerException("GoogleMaps isn't installed");
            }
            URLEncodedPostData uepd = new URLEncodedPostData(null, false);
            uepd.append("action","LOCN");
            uepd.append("a", "@latlon:"+latitude+","+longitude);
            uepd.append("title", title);
            uepd.append("description", description);
            String[] args = { "http://gmm/x?"+uepd.toString() };
            ApplicationDescriptor ad = CodeModuleManager.getApplicationDescriptors(mh)[0];
            ApplicationDescriptor ad2 = new ApplicationDescriptor(ad, args);
            ApplicationManager.getApplicationManager().runApplication(ad2, true);
        } catch(final Exception excp) {
            Dialog.alert("Sorry, can't start Google Map: " + excp.getMessage());
        }
    }
}

这是应该是这样的:


我只在模拟器测试9800(OS 6)
结果

I've tested only on simulator 9800 (OS 6)

<一个href=\"http://www.blackberryforums.com/developer-forum/143263-heres-how-start-google-maps-landmark.html\"相对=nofollow>我上心FROM HERE

这篇关于Bing地图SDK对于黑莓6.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆