Florian
Florian

Reputation: 2118

Create Bitmap from View in Android

I want to create a bitmap from a view in Android, which basically works fine using the following approach: http://www.aquajava.hu/2011/06/19/converting-view-to-bitmap-without-displaying-it/

However, I want to modify this approach. Basically, my application supports multiple display densities for all kinds of resolution. Instead of creating a bitmap from a view based on the device's display, I want that the bitmap created always relies on the HDPI version. So although the display is maybe smaller I want to create a bitmap with 480 * 800 pixels. If I just increase the size of the bitmap, the font sizes and images still stay small according to the density. I don't want to just scale the image because the resolution would be quite poor then.

So basically, I search for a way to create a bitmap from a view ignoring the density of the view.

Does anybody know how I can solve this?

Upvotes: 0

Views: 712

Answers (1)

Lawrence D'Oliveiro
Lawrence D'Oliveiro

Reputation: 2774

Have you tried calling setDensity on your Bitmap?

Upvotes: 1

Related Questions