4

I am trying to replace blue dot (which shown current location on maps) with my own icon on Google maps v2. I have tried below, none worked.

Should look like this this

Below did not work

Bitmap b = BitmapFactory.decodeResource(getResources(),
        R.drawable.location_arrow1);
googleMap.addMarker(new MarkerOptions().position(myPosition)
        .title(getIntent().getStringExtra("first_name"))
        .icon(BitmapDescriptorFactory.fromBitmap(b)));
Community
  • 1
  • 1
duggu
  • 37,851
  • 12
  • 116
  • 113

2 Answers2

8

You will have to stop using GoogleMap.setMyLocationEnabled and write a bit more code, including receiving location updates on your own and adding Circle for accuracy.

stkent
  • 19,772
  • 14
  • 85
  • 111
MaciejGórski
  • 22,187
  • 7
  • 70
  • 94
  • @Siddharth I think it is more like 10-20 lines for the whole thing ;) – MaciejGórski May 31 '13 at 11:50
  • No, you are kidding, last I counted it was 16. Oh!! you are counting the { }. Bang on man. Btw, still no appreciation from @HemantChandDungriyal. – Siddharth May 31 '13 at 12:45
  • 1
    This answer assumes far too much knowledge of the Google Maps API. – Andrew Prock Mar 31 '15 at 22:47
  • I dunno, but honestly "write a bit more code" with a link to an API reference left me on my own to find something more practical. Is there a tutorial out there? For my purposes, I wound up using information at: http://android-developers.blogspot.com/2011/06/deep-dive-into-location.html, disabling the dot and using location services to get the location. – Andrew Prock Apr 02 '15 at 18:22
  • 2
    @AndrewProck I've just noticed the link to API that was in my answer is now dead (redirecting to package summary). I've updated answer with a more appropriate link. Thanks for pointing it out. – MaciejGórski Apr 02 '15 at 18:39
  • Please quote the most relevant part of the link, in case the target site is unreachable or goes permanently offline. – Maveňツ May 21 '15 at 08:06
  • As per @leeyang :- In my experience, it worked successfully https://stackoverflow.com/questions/52007271/how-to-delete-blue-dot-in-android-google-map/52007560#52007560 – Ajay2707 Sep 05 '18 at 13:49
3

I think you pass your current location to LocationSource to be able to use the my-location button.

You have to do that on your own. - set to false gmaps.getUiSettings().setMyLocationButtonEnabled(false);

  • create your own location button
  • if you get your current location, set a marker with your icon on that
  • if you click on your location button, move the camera and center it to the map
Luser_k
  • 514
  • 1
  • 4
  • 18
  • 2
    No he did not, noone has time to go through 3 links. Instead it would be so much better if you just extract the code from your links and explain what you tried and what happened. Seriously!! how is anyone going to understand what answer in these 3 questions you are referring too. Links are discouraged for this exact reason. – Siddharth Jun 01 '13 at 18:04
  • This does not remove the blue dot, is there more? – portfoliobuilder Oct 17 '16 at 00:40