I\'m trying to take a screenshot in code in Android. Actually the screenshot is the bitmap of the main RelativeLayout. The screenshot is taken but the content appears wrong, the
This works good for me:
View content = findViewById(R.id.myElementForScreenshoot);
View screenshot = content; // or content.getRootView() for fullscreen
screenshot.refreshDrawableState();
screenshot.setDrawingCacheEnabled(true);
Bitmap b = screenshot.getDrawingCache();
After this you can process or save bitmap. Hope it helped. Cheers