Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 406811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:31:58+00:00 2026-05-12T17:31:58+00:00

I can able to show one location using co ordinates or longtitude and latitude

  • 0

I can able to show one location using co ordinates or longtitude and latitude but i dont know how to show more than one location in the blackberry MapField.If is it possible pls share with me how to do this..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:31:59+00:00Added an answer on May 12, 2026 at 5:31 pm

    Same way as How to show our own icon in BlackBerry Map?.

    Pass an array of Coordinates into custom MapField, define a bitmap for location point and paint it for each Coordinate in custom MapField paint() method.

    Remember to zoom in/out CustomMapField for best fit of all location points.

    Sample of implementation

    Lets display Liverpool Sheffield and London with custom bitmap icons (yellow circle with black border). Code for custom MapField:

    class MultyMapField extends MapField {
        Coordinates[] mPoints = new Coordinates[0];
        Bitmap mPoint;
        Bitmap mPointsBitmap;
        XYRect mDest;
        XYRect[] mPointDest;
    
        public void addCoordinates(Coordinates coordinates) {
            Arrays.add(mPoints, coordinates);
            zoomToFitPoints();
            repaintPoints();
        }
    
        protected void zoomToFitPoints() {
            // zoom to max
            setZoom(getMaxZoom());
    
            // get pixels of all points
            int minLeft = getWidth();
            int minUp = getHeight();
            int maxRight = 0;
            int maxDown = 0;
            Coordinates minLeftCoordinates = null;
            Coordinates minUpCoordinates = null;
            Coordinates maxRightCoordinates = null;
            Coordinates maxDownCoordinates = null;
            for (int i = 0; i < mPoints.length; i++) {
                XYPoint point = new XYPoint();
                convertWorldToField(mPoints[i], point);
                if (point.x <= minLeft) {
                    minLeft = point.x;
                    minLeftCoordinates = mPoints[i];
                }
                if (point.x >= maxRight) {
                    maxRight = point.x;
                    maxRightCoordinates = mPoints[i];
                }
                if (point.y <= minUp) {
                    minUp = point.y;
                    minUpCoordinates = mPoints[i];
                }
                if (point.y >= maxDown) {
                    maxDown = point.y;
                    maxDownCoordinates = mPoints[i];
                }
            }
    
            double moveToLat = maxDownCoordinates.getLatitude()
                    + (minUpCoordinates.getLatitude() - maxDownCoordinates
                            .getLatitude()) / 2;
            double moveToLong = minLeftCoordinates.getLongitude()
                    + (maxRightCoordinates.getLongitude() - minLeftCoordinates
                            .getLongitude()) / 2;
            Coordinates moveTo = new Coordinates(moveToLat, moveToLong, 0);
            moveTo(moveTo);
            // zoom to min left up, max right down pixels + 1
            int zoom = getZoom();
            boolean outOfBounds = false;
            while (!outOfBounds && zoom > getMinZoom()) {
                zoom--;
                setZoom(zoom);
                XYPoint point = new XYPoint();
                try {
                    convertWorldToField(minLeftCoordinates, point);
                    if (point.x < 0)
                        outOfBounds = true;
                    convertWorldToField(minUpCoordinates, point);
                    if (point.y < 0)
                        outOfBounds = true;
                    convertWorldToField(maxRightCoordinates, point);
                    if (point.x > getWidth())
                        outOfBounds = true;
                    convertWorldToField(maxDownCoordinates, point);
                    if (point.y > getHeight())
                        outOfBounds = true;
                } catch (IllegalArgumentException ex) {
                    outOfBounds = true;
                }
            }
            zoom++;
            setZoom(zoom);
        }
    
        protected void repaintPoints() {
            mPointsBitmap = new Bitmap(getWidth(), getHeight());
            mPointsBitmap.createAlpha(Bitmap.ALPHA_BITDEPTH_8BPP);
            mDest = new XYRect(0, 0, mPointsBitmap.getWidth(), mPointsBitmap
                    .getHeight());
            Graphics g = new Graphics(mPointsBitmap);
            if (null != mPoint) {
                mPointDest = new XYRect[mPoints.length];
                for (int i = 0; i < mPoints.length; i++) {
                    if (null == mPointDest[i]) {
                        XYPoint fieldOut = new XYPoint();
                        convertWorldToField(mPoints[i], fieldOut);
                        int imgW = mPoint.getWidth();
                        int imgH = mPoint.getHeight();
                        mPointDest[i] = new XYRect(fieldOut.x - imgW / 2,
                                fieldOut.y - imgH, imgW, imgH);
                    }
                    g.drawBitmap(mPointDest[i], mPoint, 0, 0);
                }
            }
        }
    
        protected void paint(Graphics graphics) {
            super.paint(graphics);
            if (null != mPointsBitmap) {
                graphics.setGlobalAlpha(100);
                graphics.drawBitmap(mDest, mPointsBitmap, 0, 0);
            }
        }
    }
    

    Sample of use:

    class Scr extends MainScreen {
        // test coordinates:
        // London
        // 51.507778, -0.128056
        Coordinates mLondonC = new Coordinates(51.507778, -0.128056, 0);
        // Liverpool
        // 53.4, -2.983333
        Coordinates mLiverpoolC = new Coordinates(53.4, -2.983333, 0);
        // Sheffield
        // 53.385833, -1.469444
        Coordinates mSheffieldC = new Coordinates(53.385833, -1.469444, 0);
    
        MultyMapField mMultyMapField;
    
        public Scr() {
            add(mMultyMapField = new MultyMapField());
            mMultyMapField.mPoint = createPointBitmap();
        }
    
        protected void onUiEngineAttached(boolean attached) {
            super.onUiEngineAttached(attached);
            if (attached) {
                mMultyMapField.addCoordinates(mLondonC);
                mMultyMapField.addCoordinates(mLiverpoolC);
                mMultyMapField.addCoordinates(mSheffieldC);
            }
        }
    
        private Bitmap createPointBitmap() {
            int r = 10;
            Bitmap result = new Bitmap(2 * r, 2 * r);
            result.createAlpha(Bitmap.ALPHA_BITDEPTH_8BPP);
            Graphics g = new Graphics(result);
            g.setColor(Color.BLACK);
            g.fillEllipse(r, r, 2 * r, r, r, 2 * r, 0, 360);
            g.setColor(Color.YELLOW);
            g.fillEllipse(r, r, r + (r - 2), r, r, r + (r - 2), 0, 360);
            return result;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a CustomButtonField in blackberry using that i can able to set our
I can able to post the tweet through my application using C# with twitterizer
by using directshow.net i can able to record the video and with recording i
i want to record video through webcam using Directshow.Net.i can able to record the
Can we able to create two instance of log4j in class one to write
I am using the Nitrogen version of Frama-c on Mac, and can't seem able
i able to show a status message and works without any issue but there
I am using annotation based validation but for one of the forms I am
How can I cancel a thread from another class fetching/refreshing location. I am able
After reading data from XML source I like to be able to show one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.