Smartphone Development Page 3 - How to Incorporate Location into Your BlackBerry Applications |
Retrieving information is great, but its true power comes in displaying it. After all, what good is data if you can't share it? Fortunately for us, displaying data is fairly simple. The first step is learning XML. Learning XML is necessary because BlackBerry Maps uses location documents to display information on a map. The location document itself is no more than a string that contains some XML elements and their related attributes. Because of this, you will need to know at least a little XML, and understanding the hierarchy of elements will make displaying your data a breeze. There are three main elements in a location document. They are the <lbs>, <getRoute> and <location> elements. The <lbs> element is used to contain every documentation element in a location document. For this reason, all location documents begin with <lbs> and end with the closed </lbs> element. Meanwhile, the <getRoute> element holds the route information. If you wish to display any route information on your map, you will need to place two <location> elements between your opening and closing <getRoute> tags. The first of these <location> tags acts as the starting point; the second acts as the ending point. Location elements hold the information for a location and can contain many attributes. Note however, that if you are placing a <location> element in a <getRoute> element, you can only use the x and y attributes. The following is a list of attributes that you can associate with the <location> tag: y - This integer data type holds the latitude in decimal degrees, multiplied by 100,000. x - Another integer data type that holds the longitude in decimal degrees, multiplied by 100,000. address - This string data type store the address. city - This string data type stores the city. country - Another string data type. This stores the country. categories - This string data type stores the category. description - A string data type that allows you to describe a location. email - A string data type that stores email addresses. fax - A string that hold fax numbers. label - A string data type which acts as a label for a point on the map. phone - A string that stores phone numbers. postalCode - A string that stores postal codes. rating - A double data type that allows for rating information, ranging from 0-5. url - A string that hold URL information. zoom - An integer that lets you set the zoom level from 0 to MAX_ZOOM.
blog comments powered by Disqus |
|
|
|
|
|
|
|