5

I am using google map V2 and i need to display custom image button click to get current location with blue point and no display to setMyLocationEnabled button. And already false this method but current location is display but blue point is not display.

enter image description here

  googleMap.setMyLocationEnabled(false);
James Z
  • 12,209
  • 10
  • 24
  • 44
Najib.Nj
  • 3,706
  • 1
  • 25
  • 39

2 Answers2

5

Well i guess you have your current latitude and longitude using the gps. After that it is really simple. You make a marker object and add it to the map like this.

MarkerOptions yourMakerOptions;
Marker yourMarker;


    yourMakerOptions = new MarkerOptions();
    yourMakerOptions.title("Title");
    yourMakerOptions.snippet("");
    yourMarkerOptions.position(new LatLng(currentLatitude,currentLongitude));
    //Set your marker icon using this method.
    yourMakerOptions.icon();

Finally add it to the map.

yourMarker = map.addMarker(yourMakerOptions);

To move the map to the current location call this method in onClickListener of your button.

map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(currentLatitude, currentLongitude), 14));

Hope this helps.

Try this :

map.setMyLocationEnabled(true);
map.getUiSettings().setMyLocationButtonEnabled(false);
Sarthak Gandhi
  • 2,130
  • 1
  • 16
  • 23
  • Okay. but it is no display blue point just add only marker. Another solution ? – Najib.Nj Nov 27 '17 at 09:29
  • Yes...perfect...this code..Thank You So Much.. map.setMyLocationEnabled(true); map.getUiSettings().setMyLocationButtonEnabled(false); – Najib.Nj Nov 27 '17 at 11:59
0

For getting complete information about Current location Read this

add this permission

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-feature
    android:glEsVersion="0x00020000"
    android:required="true" />

Happy coding!!

Hemant Parmar
  • 3,924
  • 7
  • 25
  • 49