This is a security breach. You should have a rooted device in order to do it.
You can use this code with your own app: (I got this code from this answer to another question: https://stackoverflow.com/a/5651242/237838 )
// image naming and path to include sd card appending name you choose for file
String mPath = Environment.getExternalStorageDirectory().toString() + "/" + ACCUWX.IMAGE_APPEND;
// create bitmap screen capture
Bitmap bitmap;
View v1 = mCurrentUrlMask.getRootView();
v1.setDrawingCacheEnabled(true);
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
OutputStream fout = null;
imageFile = new File(mPath);
try {
fout = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, fout);
fout.flush();
fout.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
Try looking this code for additional help:
P.S. It's possible to take a screenshot from Android using DDMS, but this is another story.
P.P.S. If you want to draw your launcher transparently over the activity below it you need to set pixel format to RGBA (only dealt with OpenGL) and render accordingly. You don't need to take a screenshot of the underlaying activity to do that.
Rooted device: use this code on the rooted device:
process = Runtime.getRuntime().exec("su -c cat /dev/graphics/fb0");
InputStream is = process.getInputStream();