Tag Archive for: bitmap

Android Snippet: Draw layout to a Bitmap

29 Dec
December 29, 2012

I needed this code for a project, where I needed to capture a certain list item I was rendering into a Bitmap and upload it usingĀ Facebook’s SDK.

This snippet basically “screen captures” and draws a certain view and saves it as a Bitmap and is the right way to do this.

Another solution to this is trying to draw everything on Canvas* “manually”, but taking the time to figure out all the bounds and text sizes, and getting the exact positions of things on a canvas sound like a real inconvenience. This makes it the wrong way to do this.

And you’re done!