Showing posts with label Marker is not removing from mapV2 android. Show all posts
Showing posts with label Marker is not removing from mapV2 android. Show all posts

Tuesday, May 14, 2013

[android help] Marker is not removing from mapV2 android


I am adding a maker on touch of map and want to remove that marker on click of some button but that marker is not removing from map .Here is my Code



// Marker of end Point
Marker endPointMarker;


onclick of map



@Override
public void onMapClick(LatLng point) {
// TODO Auto-generated method stub
double lat = point.latitude;
double lng = point.longitude;

// Add marker of destination point

try {
Geocoder geocoder;
List
addresses;
geocoder = new Geocoder(BookCabScreen.this);
if (lat != 0 || lng != 0) {
addresses = geocoder.getFromLocation(lat, lng, 1);
String address = addresses.get(0).getAddressLine(0);
String city = addresses.get(0).getAddressLine(1);
String country = addresses.get(0).getAddressLine(2);
Log.d("TAG", "address = " + address + ", city =" + city
+ ", country = " + country);
endPointMarker = mMap.addMarker(new MarkerOptions()
.position(new LatLng(lat, lng))
.title("Location").snippet("" + address));

markers.add(mMap.addMarker(new MarkerOptions()
.position(new LatLng(lat, lng))
.title("Location").snippet("" + address)));
btnStartUp.setEnabled(true);
btnStopPoint.setEnabled(true);

mJbBookCab.setEndPointLat(lat);
mJbBookCab.setEndPointLng(lng);
} else {
Toast.makeText(BookCabScreen.this,
"latitude and longitude are null",
Toast.LENGTH_LONG).show();

}
} catch (Exception e) {
e.printStackTrace();

}


}


on click of button



if (endPointMarker != null) {
endPointMarker.remove();

endPointMarker = null;
}


But it is not removing from map ?Please help



.

stackoverflow.comm

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...