BlackBerry Forums Support Community               

Closed Thread
LinkBack Thread Tools
Old 05-16-2011, 09:32 AM   #1 (permalink)
Thumbs Must Hurt
Join Date: Mar 2011
Model: 8900
Carrier: Torch
Posts: 59
Post Thanks: 3
Thanked 1 Time in 1 Post
Default Select Location & draw map

Please Login to Remove!


I am j2me api to draw map in such a way that user enter country & map is drawn . my code is

public MyClass(){

public void selectLocation(){
Application.getApplication().invokeAndWait( new Runnable() {

public void run() {
/*try {
final Criteria c = new Criteria();
c.setPreferredPowerConsumption(Criteria.POWER_USAG E_LOW);
lp = LocationProvider.getInstance(c);
} catch (LocationException e) {
if (lp == null) {

lp = LocationProvider.getInstance(null);


if (lp == null) {
Dialog.alert("location not found");
lp.setLocationListener(new MyListener(), 5, 1, 1);


protected void makeMenu(Menu menu, int instance) {

super.makeMenu(menu, instance);
menu.add(new MenuItem("Select Location",1,1) {

public void run() {
MapView _mapv = new MapView();
_mapv.setLatitude((int) (1e5 * lat));
_mapv.setLongitude((int) (1e5 * lng));
Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(_mapv));
}catch (Exception e) {


private class MyListener implements LocationListener
public void locationUpdated(LocationProvider provider, Location loc)


lat = loc.getQualifiedCoordinates().getLatitude();
lng = loc.getQualifiedCoordinates().getLongitude();
alt = loc.getQualifiedCoordinates().getAltitude();

catch (Exception e) {
Dialog.alert("Cannot find location");

public void providerStateChanged(LocationProvider provider, int newState) {
// TODO Auto-generated method stub


Above code was creating map for America & Canada only for other countries it is throwing null pointer exception..

Any body knows why it throws exception for other countries
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: Select Location & draw map
Thread Thread Starter Forum Replies Last Post
Maps opens and finds location but no actual map displayed phudson86 General BlackBerry Discussion 4 05-03-2010 02:26 PM
Send GPS position directly to a public Google Map website wesko GPS & Mapping 0 07-22-2008 05:06 PM
Pearl Issues (emails and call logs getting deleted automatically) bacardinole General 8100 Series Discussion - Pearl 35 11-16-2007 12:16 AM
new 8820 report / Yahoo! Go question btaylor1 General Legacy Device Discussion 5 09-23-2007 03:25 PM
7100I Big HELP whoknowswhat General Legacy Device Discussion 1 10-23-2005 03:45 PM

Pair Of Two Vintage Mac Tools Wrenches SAE Good Condition
Pair Of Two Vintage Mac Tools Wrenches SAE Good Condition pictureVintage Mac Tools No. 200 Dial Indicator Set
Vintage Mac Tools No. 200 Dial Indicator Set pictureNew Vintage Velocette MAC 350cc Single 1949 Petrol Fuel Gas Tank
New Vintage Velocette MAC 350cc Single 1949 Petrol Fuel Gas Tank pictureVintage Mac Allied Hex Rethreader Dies - # TR-8-U in Case
Vintage Mac Allied  Hex Rethreader Dies - # TR-8-U in Case  pictureVtg MAC Tools X106 5/16" Chrome SAE Socket 3/8" Drive 6 Point Sabina Ohio USA
Vtg MAC Tools X106 5/16

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.