Reputation: 900
I want to sleep and then draw in onDraw:
protected void onDraw(Canvas canvas) {
if (_rectPath) {
canvas.drawPath(mRectPath, mFillPaint);
// SLEEP HERE for 5 seconds
canvas.drawPath(mRectPath, mNPaint);
}
canvas.drawPath(mPath, mPaint);
}
How would I implement sleeping for 5 sec? Basically I want it to wait 5 sec and then draw the next path, mNPaint.
Thanks!
Upvotes: 0
Views: 943
Reputation: 3885
You could use this method. Initialize Handler out side the ondraw method
Handler handler = new Handler();
And inside onDraw method
handler.postDelayed(new Runnable() {
@Override
public void run() {
//Draw the previous paths.
// Adjust the paths here and draw it
invalidate();
}
}, 5 * 1000);
Upvotes: 3