Hello everyone i have a problem with my application onMarkerClick
it works well till i click the marker second time the application crashes here is the code:
mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
@Override
public boolean onMarkerClick(Marker marker) {
builder.setTitle("Set radius in meters:");
builder.setMessage("Info: The radius is set by default on 500 meters");
// Specify the type of input expected; this, for example, sets the input as a password, and will mask the text
input.setInputType(InputType.TYPE_CLASS_NUMBER);
builder.setView(input);
// Set up the buttons
builder.setPositiveButton("Set", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
m_Text = Integer.parseInt(input.getText().toString());
Toast.makeText(getBaseContext(), "Radius set to: " + m_Text + " meters;", Toast.LENGTH_LONG).show();
circle.setRadius(m_Text);
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();
return false;
}
});
The error is The specified child already has a parent. You must call removeView() on the child's parent first.
and the line is where return false
is.