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 7621615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:14:23+00:00 2026-05-31T04:14:23+00:00

Is it possible to over-ride MyLocationOverlay()’s onDraw method and replace the standard flashing blue

  • 0

Is it possible to over-ride MyLocationOverlay()’s onDraw method and replace the standard flashing blue icon with something else. What are the ways I could implement 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-31T04:14:25+00:00Added an answer on May 31, 2026 at 4:14 am

    Really good answer to your question here:
    myLocationOverlay change the marker

    Draw an animated GIF image within the drawMyLocation(..) function. Display Animated GIF

    public class CurrentLocationOverlay extends MyLocationOverlay {
    
      // TODO: use dynamic calculation?
      private final static int PADDING_ACTIVE_ZOOM     = 50;
    
      private MapController    mc;
      private Bitmap           marker;
      private Point            currentPoint            = new Point();
    
      private boolean          centerOnCurrentLocation = true;
    
      private int              height;
      private int              width;
    
      /**
       * By default this CurrentLocationOverlay will center on the current location, if the currentLocation is near the
       * edge, or off the screen. To dynamically enable/disable this, use {@link #setCenterOnCurrentLocation(boolean)}.
       *
       * @param context
       * @param mapView
       */
      public CurrentLocationOverlay(Context context, MapView mapView) {
        super(context, mapView);
        this.mc = mapView.getController();
        this.marker = BitmapFactory.decodeResource(context.getResources(), R.drawable.position);
      }
    
      @Override
      protected void drawMyLocation(Canvas canvas, MapView mapView, Location lastFix, GeoPoint myLocation, long when) {
        // TODO: find a better way to get height/width once the mapView is layed out correctly
        if (this.height == 0) {
          this.height = mapView.getHeight();
          this.width = mapView.getWidth();
        }
        mapView.getProjection().toPixels(myLocation, currentPoint);
        canvas.drawBitmap(marker, currentPoint.x, currentPoint.y - 40, null);
      }
    
      @Override
      public synchronized void onLocationChanged(Location location) {
        super.onLocationChanged(location);
        // only move to new position if enabled and we are in an border-area
        if (mc != null && centerOnCurrentLocation && inZoomActiveArea(currentPoint)) {
          mc.animateTo(getMyLocation());
        }
      }
    
      private boolean inZoomActiveArea(Point currentPoint) {
        if ((currentPoint.x > PADDING_ACTIVE_ZOOM && currentPoint.x < width - PADDING_ACTIVE_ZOOM)
            && (currentPoint.y > PADDING_ACTIVE_ZOOM && currentPoint.y < height - PADDING_ACTIVE_ZOOM)) {
          return false;
        }
        return true;
      }
    
      public void setCenterOnCurrentLocation(boolean centerOnCurrentLocation) {
        this.centerOnCurrentLocation = centerOnCurrentLocation;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to over-ride methods that are part of Ruby itself, such as
Is it possible to override the GetHashCode method for a string, int, int32 etc..
Is it possible to override the standard layouts that are provided with Android? Is
Is it possible to override the to_sentence method just for one model in my
Is it possible to override a private method by using Reflection in .NET 3.5?
Is it possible to make the MyLocationOverlay marker clickable? I have to launch a
I have two modules that should over ride other urls, basically /management/category/edit/id/1 (Edit Category
Is it at all possible to override a private method of a super class
Is it possible to override the paint method, or draw onto a JFrame with
Is it possible to override the standard AboutDialog provided by RCP?

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.