0

我有一个带有“获取 GPS”按钮的常规 HTML 表单。单击后,我希望打开一个弹出窗口并调用黑莓地图。

我希望 mapLocation 在带有关闭按钮的新对话框中打开。

例如:

function mapLocation(lat, lon) {
  var args = new blackberry.invoke.MapsArguments(lat, lon);
  blackberry.invoke.invoke(blackberry.invoke.APP_MAP​S, args);
}
4

1 回答 1

1

尝试这个:

public class TestMapField extends MainScreen
{
    TestMapField()
    {
        super();

        ButtonField btn = new ButtonField("hello");
        btn.setChangeListener(fcl);
        add(btn);   

    }
    FieldChangeListener fcl = new FieldChangeListener()
    {
        public void fieldChanged(Field field, int context) {
            MapField mapField;
            int lat = (int) (43.4631 * 100000);
            int lon = (int) (-80.5327*100000);

            mapField = new MapField(MapField.FIELD_HCENTER);
            mapField.setPreferredSize(200, 150);
            mapField.moveTo(lat,lon);
            mapField.setZoom(0);
            HorizontalFieldManager hfm = new HorizontalFieldManager();
            hfm.add(mapField);
            PopupScreen obj = new PopupScreen(hfm);
            UiApplication.getUiApplication().pushScreen(obj);   
        }       
    };  
}
于 2011-01-10T12:11:36.007 回答