I am using the following code to take a screenshot of a TableLayout. I must add that the theme of my android application is set to LIGHT. It shows perfectly fine on the emulator screen (just like it is supposed to)….however, once the screenshot is taken, the image turns out to be like this…can anyone help point out what I am doing wrong here? Thanks!
private void getScreen()
{
View content = findViewById(R.id.TransactionLog);
content.setDrawingCacheEnabled(true);
content.buildDrawingCache(true);
Bitmap bitmap = Bitmap.createBitmap(content.getDrawingCache());
content.setDrawingCacheEnabled(false); // clear drawing cache
File file = new File(Environment.getExternalStorageDirectory() +
File.separator + "logDetails.jpeg");
try
{
file.createNewFile();
FileOutputStream ostream = new FileOutputStream(file);
bitmap.compress(CompressFormat.JPEG, 100, ostream);
ostream.flush();
ostream.close();
}
catch (Exception e)
{
e.printStackTrace();
}
if (!file.exists()) {
sendmail();
}
}

1) you should use png. Jpeg is for photos (basically).
2) because you’re using Jpeg, I assume those black areas would otherwise be transparent. Png supports transparency. Jpeg does not. I have not tried drawingCache, so maybe it doesn’t support transparency either and I’m totally wrong, but that’s my guess.
So, summary, try Png.