views:

421

answers:

1

Hi,

Would anyone please try to explain to me why

public void addView(View child) {
  child.setDrawingCacheEnabled(true);
  child.setWillNotCacheDrawing(false);
  child.setWillNotDraw(false);
  child.buildDrawingCache();
  if(child.getDrawingCache() == null) { //TODO Make this work!
    Log.w("View", "View child's drawing cache is null");
  }
  setImageBitmap(child.getDrawingCache()); //TODO MAKE THIS WORK!!!
}

ALWAYS logs that the drawing cache is null, and sets the bitmap to null?

Do I have to actually draw the view before the cache is set?

Thanks!

A: 

On 2.0.1, the cache value is true (you can verify that by doing view.isDrawingCacheEnabled), but the bitmap returned by getDrawingCache is null.

A P
So...it's the way it should work???
Bex
Nope.. Possibly a bug in Android. My comment wasn't meant as a solution / answer, but I just shared my similar experience with getDrawingCache. Sorry I wasn't clear.
A P