I need to convert large view (width and height as 1920x840) to Bitmap. I am getting java.lang.OutOfMemoryError exception on low end devices whose memory size less. I tried this code.
setDrawingCacheEnabled(true);
buildDrawingCache();
Bitmap b = getDrawingCache();
if (b == null) {
int width = getLayoutParams().width;
int height = getLayoutParams().height;
//here i am getting out of memory exception
b = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
draw(c);
}
destroyDrawingCache();
setDrawingCacheEnabled(false);
return b;