I am trying to test code to take screenshot on the android emulator. I have the following code to start with:
View content = ((ViewGroup)findViewById(android.R.id.content)).getChildAt(0);
content.setDrawingCacheEnabled(true);
Bitmap bitmap = Bitmap.createBitmap(content.getDrawingCache());
content.setDrawingCacheEnabled(false);
But I get null pointer exception in createBitmap at line 551.
Can someone please point out what am I doing wrong.