Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 242
Registered: ‎02-19-2013
My Device: 9500
My Carrier: _

Map appear white not showing location

Map appear blank white on blackberry device.

 

 

public class GeoMapField extends MainScreen {
    
    CustomMapField mapField;
    Coordinates mCoordinates;
    LocationProvider provider = null;
    Location location = null;
    
    public GeoMapField() {
        UiApplication.getUiApplication().invokeLater(new Runnable(){
            public void run(){
                final Criteria myCriteria = new Criteria();
                myCriteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
                myCriteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
                myCriteria.setCostAllowed(true);
                myCriteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
                try {
                    
                    Thread t = new Thread(new Runnable() {
                        public void run() {
                            try {
                                synchronized(UiApplication.getEventLock()){
                                    //provider = LocationProvider.getInstance(myCriteria);
                                    //location = provider.getLocation(60);
                                    //mCoordinates = location.getQualifiedCoordinates();
                                    
                                    mCoordinates = new Coordinates(26.91136925, 75.80642, Float.NaN);
                                    //add(new LabelField("Latitude: " + String.valueOf(Coordinates.convert(mCoordinates.getLatitude(),Coordinates.DD_MM_SS))));
                                    //add(new LabelField("Longitude: " + String.valueOf(Coordinates.convert(mCoordinates.getLongitude(), Coordinates.DD_MM_SS))));
                                    mapField = new CustomMapField();
                                    mapField.setZoom(10);
                                    //mapField.mIcon = Bitmap.getBitmapResource("poi_icon.png");
                                    mapField.moveTo(mCoordinates);
                                    add(mapField);
                                }
                            } catch(Exception e) {
                                System.out.println("Exception at:" + e.getMessage());
                            }
                        }
                    });
                    t.start();
                } catch (Exception e1) {
                    System.out.println("Exception " + e1.getMessage());
                }
            }
        });
    }
    
    class ThreadLocal extends Thread {
        public void run() {
            
            
        }
    }
}

 

Could any one suggest me why its so?

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Map appear white not showing location

Following code works for me, compare it with your code and I'm guessing the problem is one of the following:

 

1) BlackBerry maps does not like the location or latitude

2) There is an issue with your CustomMap Object

3) You are testing and don't have connectivity so the maps can not be downloaded (e.g. no MDS Simulator when running on Simulator).

 

I suggest you investigate and figure out what the problem is.  Good luck:

 

Coordinates mCoordinates = new Coordinates(43.46310, -80.52070, 0);
MapField mapField = new MapField();
mapField.setZoom(10);
mapField.moveTo(mCoordinates);
add(mapField);

Developer
Posts: 242
Registered: ‎02-19-2013
My Device: 9500
My Carrier: _

Re: Map appear white not showing location

I am using your latitude and longitude its opened but when i give the latitude and longitude of india then its blank(grey color) in emulator.

 

Coordinates mCoordinates = new Coordinates(26.911369, 75.806421, 0);
        MapField mapField = new MapField();
        mapField.setZoom(10);
        mapField.moveTo(mCoordinates);
        add(mapField);

 

Can you tell me why its so??

 

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Map appear white not showing location

Developer
Posts: 242
Registered: ‎02-19-2013
My Device: 9500
My Carrier: _

Re: Map appear white not showing location

[ Edited ]

Can we apply the zoom in and zoom out , swap gestures in map field.

Highlighted
Developer
Posts: 104
Registered: ‎08-03-2010
My Device: Blackberry Z10
My Carrier: Idea

Re: Map appear white not showing location

Yes you can try the mapfield demo from the blackcberry sample it will give you a good idea.

Please mark posts as solved if you found a solution.
Feel free to press the kudos button to thank the user that helped you