I'm trying to draw a series of points (coordinates), in Android Studio, but I only get to draw the last coordinate that happened, here I leave the code I have
class Vista extends View {
Paint paint = new Paint();
public Vista(Context context) {
super(context);
paint.setColor(Color.RED);
paint.setStrokeWidth(15);
paint.setStyle(Paint.Style.STROKE);
}
public void onDraw(Canvas canvas) {
X_coordenadas.add((float) 100);
X_coordenadas.add((float) 200);
X_coordenadas.add((float) 300);
Y_coordenadas.add((float) 100);
Y_coordenadas.add((float) 200);
Y_coordenadas.add((float) 300);
for(int i=0; i<X_coordenadas.size();i++) {
float x = X_coordenadas.get(i);
float y = Y_coordenadas.get(i);
Bitmap b = BitmapFactory.decodeResource(getResources(), R.drawable.planta2_as);
canvas.drawBitmap(b, 0, 0, paint);
canvas.drawPoint(x, y, paint);
super.onDraw(canvas);
}
}
If someone could tell me how to do it, I'd really appreciate it
Greetings