user31231234124 user31231234124 - 14 days ago 10
Android Question

Listener for onDraw method

Following is my onDraw method.

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);

if(inte < listOfPoints.size()){
canvas.drawLine(listOfPoints.get(0).x, listOfPoints.get(0).y, listOfPoints.get(inte).x,listOfPoints.get(inte).y, paint);
inte++;

if(inte < listOfPoints.size()){
invalidate();
}
}
}


Is it possible to get a callback once if the canvas has finished drawing the above point?

Answer

OnDraw is automatically called for situations that need to be drawn inside the view, so a Canvas is provided, so it will be called as long as the list size.

Comments