I am trying to get View converted in bitmap.
In emulator my program is working fine and running as expected but when I run the same code in Device it gives null pointer Exception at particular line :
Bitmap b = Bitmap.createBitmap(view.getDrawingCache());
where view is object of RelativeLayout having Layout of current Activity.
Can someone guide how can I resolve this issue.
Thanks.
You need to call
measureandlayouton your view before usinggetDrawingCache(). Otherwise it will return null.