I have added google map in my app.I am showing current location on google map.I show a red marker on my current location now on tap of marker i want show the address above marker in a popup like which we normally see in apps.I have tried some the ways but none of them worked for me.sharing the code here.
1.First Way i tried
@Override
public void onLocationChanged(Location location) {
mMap.clear();
latitude = location.getLatitude();
longitude = location.getLongitude();
MarkerOptions mo=new MarkerOptions();
LatLng latLng = new LatLng(latitude, longitude);
marker=mMap.addMarker(mo.position(latLng));
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.zoomTo(15));
mo.title("Current Location");
}
2.Second Way i tried
mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker arg0) {
String title = "Any Thing You want";
marker.setTitle(title);
return true;
}
});
Please tell where i am mistaken here.Thanks