I would like to have ONLY the circle and not every line to every point of the circle... you have have further explanations looking at the image:
This is the code that I'm using right now:
final View rootView = layoutInflater.inflate(R.layout.fragment_new_alert, paramViewGroup, false);
FrameLayout fram_map = (FrameLayout) rootView.findViewById(R.id.fram_map);
Button btn_draw_State = (Button) rootView.findViewById(R.id.btn_draw_State);
isMapMoveable = false; // to detect map is movable
SupportMapFragment customMapFragment = ((SupportMapFragment) getActivity().getSupportFragmentManager().findFragmentById(R.id.map));
mMap = customMapFragment.getMap();
btn_draw_State.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
isMapMoveable = !isMapMoveable;
}
});
fram_map.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
float x = event.getX();
float y = event.getY();
int x_co = Math.round(x);
int y_co = Math.round(y);
Point x_y_points = new Point(x_co, y_co);
LatLng latLng = mMap.getProjection().fromScreenLocation(x_y_points);
if (!isMapMoveable) {
return false;
}
int eventaction = event.getAction();
switch (eventaction) {
case MotionEvent.ACTION_DOWN:
// finger touches the screen
if (polyline != null){
polyline.setZIndex(0);
polyline.remove();
val.removeAll(polyline.getPoints());
}
val.add(latLng);
case MotionEvent.ACTION_MOVE:
// finger moves on the screen
val.add(latLng);
case MotionEvent.ACTION_UP:
// finger leaves the screen
drawMap();
break;
}
return true;
}
});
return rootView;
}
public void drawMap() {
rectOptions = new PolylineOptions();
rectOptions.addAll(val);
rectOptions.color(Color.RED);
rectOptions.width(7);
polyline = mMap.addPolyline(rectOptions);
}
Based on the code found here: How to draw free hand polygon in Google map V2 in Android?
Any idea? :) thanks!