|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--net.rim.blackberry.api.invoke.ApplicationArguments
|
+--net.rim.blackberry.api.invoke.MapsArguments
Encapsulates arguments to pass to the BlackBerry Maps application.
| Field Summary | ||
|
static String |
ARG_LOCATION_DOCUMENT
Argument to open Maps and display points using the provided location document |
| Constructor Summary | ||
|
MapsArguments()
Creates a new MapsArguments instance with default arguments. |
|
|
MapsArguments(Contact contact,
int addressIndex)
Creates a new MapsArguments instance with provided arguments |
|
|
MapsArguments(MapView mapView)
Creates a new MapsArguments instance with a specified view. |
|
|
MapsArguments(String arg,
String locationDocument)
Creates a new MapsArguments instance with provided arguments. |
|
| Method Summary |
| Methods inherited from class net.rim.blackberry.api.invoke.ApplicationArguments |
getArgs |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String ARG_LOCATION_DOCUMENT
| Constructor Detail |
public MapsArguments()
The default arguments instruct Maps to open in the default view or last lat/long.
public MapsArguments(Contact contact, int addressIndex)
contact - A contact with at least one address. The Maps application will start and attempt to search for one of the
addresses for the contact. If the contact has no addresses, when invoked with this MapsArgument the Maps application will
open to the default location.addressIndex - The index (beginning at 0) of the address you would like displayed. If the index is invalid,
when invoked with this MapsArgument the Maps application will open to the default location.public MapsArguments(MapView mapView)
mapView - The view used to display the mappublic MapsArguments(String arg, String locationDocument)
In the application code, you must multiply the latitudinal and longitudinal values used by the javax.microedition.locationCoordinates class by 100,000. For example if the internal GPS returns values of 45.000 and -75.000 for the longitude and latitude of a location, you must multiply each of these values by 1000 and send the resulting values to the location document.
In the following examples, the internal GPS of a BlackBerry device returns values of 45.000 and -75.000 for the longitude and latitude of a location. After multiplying each value by 100000, your application code sends 45000 and -75000 to the location document. BlackBerry maps interprets and displays these values as 45 degrees longitude and -75 degrees latitude respectively.
Example 1: Invoke BlackBerry Maps to display a single location:
String location = "<lbs>" + "<location lat='-7500000' lon='4500000'/>" + "</lbs>";
Example 2: Invoke BlackBerry Maps to display multiple points of interest:
String location = "<lbs>"
+ " <location lat='-7500000' lon='4500000' label='TestPoint1' description='This could have a phone number. 555-1212'/>"
+ " <location lat='-7500000' lon='4500100' label='TestPoint2' description='This could have a phone number. 555-1212'/>"
+ " <location lat='-7500000' lon='4500200' label='TestPoint3' description='This could have a phone number. 555-1212'/>"
+ "</lbs>";
Example 3: Invoke BlackBerry Maps to display a route:
String route = "<lbs>" + "<getRoute>"
+ "<location lat='-7569792' lon='4542349' address='Ottawa, ON, CANADA'/>"
+ "<location lat='-7938675' lon='4367022' address='Toronto, ON, CANADA'/>"
+ "</getRoute>" + "</lbs>";
Example 4: Invoke BlackBerry Maps to display a route:
Call Invoke.invokeApplication(int appType, ApplicationArguments args)
using the Invoke.APP_TYPE_MAPS constant parameter and a new
MapsArguments object created using the contact object.
Contact c = null;
try { ContactList cl = (ContactList)PIM.getInstance().openPIMList( PIM.CONTACT_LIST, PIM.READ_ONLY );
Enumeration e = cl.items();
c = (Contact)e.nextElement();
} catch (Exception e) {
}
Invoke.invokeApplication( Invoke.APP_TYPE_MAPS, new MapsArguments( c, 0 ) );
See the BlackBerry Java Development Environment Developer Guide for more information about working
with BlackBerry Maps and map arguments.
arg - Specify ARG_LOCATION_DOCUMENT to open BlackBerry Maps to display the points
of interest in the location document. The lat and lon parameters represent longitude and latitude respectively.locationDocument - A string that contains location data.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2008 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.