简体   繁体   English

j2me:关于地标类的问题

[英]j2me :question about Landmark class

i am trying to invoke blackberry map and label a location by address. 我正在尝试调用黑莓地图并通过地址标记位置。 i tried the sample code as following 我尝试了以下示例代码

public class invokeMaps
{
    public invokeMaps ()
    {
        Landmark[] landMarks = new Landmark[3];

        AddressInfo addressInfo = new AddressInfo();
        addressInfo.setField(AddressInfo.STREET, "455 Phillip St");
        addressInfo.setField(AddressInfo.CITY, "Waterloo");
        addressInfo.setField(AddressInfo.STATE, "Ontario");

        landMarks[0] = new Landmark("AAA", "Description 1", null, addressInfo);

        QualifiedCoordinates coordinates =
          new QualifiedCoordinates(45.4, -75.1, 0, 0, 0);

        landMarks[1] = new Landmark("BBB", "Description 2", coordinates, null);

        coordinates = new QualifiedCoordinates(45.3,-75.3,0,0,0);

        landMarks[2] = new Landmark("CCC", "Description 3", coordinates, null);

        MapsArguments ma = new MapsArguments(landMarks);
        Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, ma);
  }
}

it only labels BBB and CCC, AAA is missing. 它仅标记BBB和CCC,缺少AAA。 i think that is because of AAA missing coordinates. 我认为这是因为AAA缺少坐标。 my question is how can i retrive the coordinates for a location if i only have the address. 我的问题是,如果我只有地址,该如何获取位置的坐标。

I bet you have to call a remote service which can translate addresses into collections of coordinates. 我敢打赌,您必须致电远程服务,该服务可以将地址转换为坐标集合。 The google places API looks promising. Google Places API看起来很有希望。

我发现MapsArguments(Contact contact,int addressIndex)不需要坐标就可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM