So my problem is the output of this code is this (the square one) instead of what I should expect. Any ideas why this happens?
I'll explain this much further, the output is basically a square like image but not really square but it contains all the view but it is compressed unlike what we should expect, a fullscreen size image with all the views in the proper place:
Code:
private Bitmap getScreenshot(int id) {
Log.d(TAG, "Creating screenshot");
RelativeLayout RL= (RelativeLayout)findViewById(id);
View v1 = getWindow().getDecorView().getRootView(); //or RL.getRootView();
v1.setDrawingCacheEnabled(true);
v1.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
v1.layout(0, 0, v1.getMeasuredWidth(), v1.getMeasuredHeight());
v1.buildDrawingCache(true);
Bitmap bm = Bitmap.createBitmap(v1.getDrawingCache());
v1.setDrawingCacheEnabled(false);
return bm;
}
Image: