How to show our own icon on the BlackBerry Map?

I want to know how to use our own logo to show a specific place in BBMap? Does anyone know how to do this?

+4
source share
1 answer

Blackberry Card

Blackberry Map cannot display custom icon for POI.
Things you can include in a location on a Blackberry map:

  • Latitude of location * 100,000. South negative.
  • The longitude of the location is * 100,000. The West is negative.
  • The label displayed next to it.
  • Description displayed when user selects BlackBerry smartphone
    the details.
  • Scale level from 0 to MAX_ZOOM.
  • Address
  • City
  • Province or State
  • Country
  • Postcode
  • Telephone
  • Fax
  • URL
  • E-mail address
  • Category
  • Rating information from 0 to 5

See What is a BlackBerry Maps Location Document Format

Also see How To - Call BlackBerry Cards

Using MapField

Alternatively, you can try MapField + manager / screen overrides.

Custom extension for MapField:

class CustomMapField extends MapField { Bitmap mIcon; XYRect mDest; public void moveTo(Coordinates coordinates) { super.moveTo(coordinates); mDest = null; } protected void paint(Graphics graphics) { super.paint(graphics); if (null != mIcon) { if (null == mDest) { XYPoint fieldOut = new XYPoint(); convertWorldToField(getCoordinates(), fieldOut); int imgW = mIcon.getWidth(); int imgH = mIcon.getHeight(); mDest = new XYRect(fieldOut.x - imgW / 2, fieldOut.y - imgH, imgW, imgH); } graphics.drawBitmap(mDest, mIcon, 0, 0); } } } 

Usage example:

 class Scr extends MainScreen { CustomMapField mMapField; Coordinates mCoordinates; public Scr() { LocationProvider provider = null; Location location = null; try { provider = LocationProvider.getInstance(null); } catch (LocationException e) { e.printStackTrace(); } try { location = provider.getLocation(-1); } catch (LocationException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } mCoordinates = location.getQualifiedCoordinates(); 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)))); mMapField = new CustomMapField(); mMapField.mIcon = Bitmap.getBitmapResource("poi_icon.png"); mMapField.moveTo(mCoordinates); add(mMapField); } } 

see also
Using MapComponent in Blackberry
GPS and BlackBerry Map Development Guide

Prepare GPS data

If this is a real device, make sure GPS is accessible and turned on.
If this is a simulator, then before starting the program, use the simulator menu → simulate → GPS location to set GPS data.
Another option is to hardcode your own Coordinates and use them without GPS:

  double latitude = 51.507778; double longitude = -0.128056; Coordinates mCoordinates = new Coordinates(latitude, longitude, 0); 
+6
source

All Articles