I am trying to capture my activity's screen on android. I am using the code below:
View root = this.activity.getWindow().getDecorView().getRootView();
Bitmap b = Bitmap.createBitmap(root.getWidth(), root.getHeight(), Config.RGB_565);
Canvas c = new Canvas(b);
root.draw(c);
if (b != null && !b.isRecycled()) {
this.screen = Bitmap.createBitmap(b);
}
If on-screen keyboard pops up, then I've got only visible part of my activity's window in this.screen
and the rest is blank.
Is there any way to get my app's screenshot, including the parts, that are under on-screen keyboard?