Android 2.1 View's getDrawingCache() method always returns null
- by Impression
Hello,
I'm working with Android 2.1 and have the following problem:
Using the method View.getDrawingCache() always returns null.
Example code:
public void onCreate(final Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final View view = findViewById(R.id.ImageView01);
view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
final Bitmap bmp = view.getDrawingCache();
System.out.println(bmp);
}
I've already tried different ways to configure the View object for generating the drawing cache (e.g. View.setWillNotDraw(boolean) and View.setWillNotCacheDrawing(boolean)), but nothing works.
What is the right ways, or what do I wrong?