4

I want to know how to use our own logo to show the particular place in BBMap? Can anyone knows how to do this ?

Lucifer
  • 29,392
  • 25
  • 90
  • 143
Kumar
  • 5,469
  • 20
  • 64
  • 87

1 Answers1

6

BlackBerry Map

It's not possible in Blackberry Map to show custom icon for POI.
Things you can include in Location on Blackberry Map:

  • The latitude of the location * 100,000. South is negative.
  • The longitude of the location * 100,000. West is negative.
  • The label to be displayed beside the location.
  • The description displayed when the BlackBerry smartphone user selects
    details.
  • Zoom level from 0 to MAX_ZOOM.
  • Address
  • City
  • Province or state
  • Country
  • Postal code
  • Phone
  • Fax
  • URL
  • Email address
  • Category
  • Rating information between 0 and 5

See What Is - BlackBerry Maps Location Document Format

Also see How To - Invoke BlackBerry Maps

Using MapField

As an alternative you can try MapField + manager/screen paint override.

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);
        }
    }
}

Example of use:

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 Maps Development Guide

Prepare GPS data

If it's real device, be sure GPS is available and turned on.
If it's simulator, then before you start program use simulator menu -> simulate -> GPS Location to set GPS data.
Other option is hardcode your own Coordinats and use them without GPS:

    double latitude = 51.507778;
    double longitude = -0.128056;
    Coordinates mCoordinates = new  Coordinates(latitude, longitude, 0);
Undo
  • 25,519
  • 37
  • 106
  • 129
Maksym Gontar
  • 22,765
  • 10
  • 78
  • 114
  • 1
    Hi coldice..Thanks for ur information,But i can able to invoke a Blackberry map and i can able to show the particular location using longtitude and latitude but now i m trying to change the default pinpoint image to some other image to indicate the location.Is it possible to change the default pinpoint image in Blackberry Map? If possible pls tell me how to do?.. – Kumar Oct 07 '09 at 07:21
  • Sorry, but it's not possible to set custom icon for location in BlackBerry Map application. However there are ways to do it using google maps or MapField inside your application. – Maksym Gontar Oct 07 '09 at 07:25
  • Thanks,can pls provide some code snippet to using Mapfield and google Maps. – Kumar Oct 07 '09 at 08:45
  • See sample for MapField. Talking about GoogleMaps, in deeper investigation I've found out it's not possible, because Blackberry browser has bad JavaScript support yet and static maps require server side solution + google maps api key registration. :) sorry – Maksym Gontar Oct 07 '09 at 12:00
  • HI coldice i dont know how to set longtitude and latitude.If i run the above program then i can get map image "with NO DATA AVAILABLE" Label. – Kumar Oct 08 '09 at 05:26
  • I had to remove the image from your post because ImageShack has deleted it and replaced it with advertising. See http://meta.stackexchange.com/q/263771/215468 for more information. If possible, it would be great for you to re-upload them. Thanks! – Undo Sep 22 '15 at 00:46