title: Android: How to get a custom view to redraw partially?
body: <p>I have a custom view that fills my entire screen. (A piano keyboard)
  When a user touches the key, it causes <code>invalidate()</code> to be called and the whole keyboard gets redrawn to show the new state with a touched key.</p>
  
  <p>Currently the view is very simple, but I plan to add a bit more nice graphics. Since the whole keyboard is dynamically rendered this would make redrawing the entire keyboard more expensive.</p>
  
  <p>So I thought, let's look into partial redrawing. Now I call <code>invalidate(Rect dirty)</code> with the correct dirty region. I set my <code>onDraw(Canvas canvas)</code> method to only draw the keys in the dirty region if I do indeed want a partial redraw. This results in those keys being drawn, but the rest of the keyboard is totally black/not drawn at all.</p>
  
  <p>Am I wrong in expecting that calling <code>invalidate(Rect dirty)</code> would "cache" the current <code>canvas</code>, and only "allows" drawing in the dirty region? </p>
  
  <p>Is there any way I can achieve what I want? (A way to "cache" the canvas and only redraw the dirty area?"</p>