Waypoint
Waypoint

Reputation: 17753

Android - drawText invalidate

I am drawing on Canvas about who is on turn now. I am using validate() twice to invalidate the screen and drawing text again. But with invalidate() I am redrawing all board, which last quite a long, is there any way how to invalidate just this part of Canvas?

Thanks

Hmyzak

Upvotes: 1

Views: 601

Answers (1)

Reuben Scratton
Reuben Scratton

Reputation: 38707

Not really, no. You have two options:

  1. Put the bit of UI you want to update into it's own child View and simply invalidate() that particular view when needed.

  2. If drawing the other parts of your View is so expensive, that's a great reason to use the drawing cache. Check out View.setDrawingCacheEnabled() and friends.

Upvotes: 1

Related Questions