开发者

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. i think that is because of AAA missing coordinates. 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.


i found MapsArguments(Contact contact, int addressIndex) works without the need of coordinates.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜