0
votes

My application provides a Custom View that via method onDraw() draws some large shapes over the display. My intent is to convert this large Canvas in a Bitmap but if I use createBitmap() method, passing canvas.getWidth(), canvas.getHeight() parameters I receive a Runtime Exception caused by creation of Bitmap (OutOfMemory).

How can I resolve this problem? Some suggestions?

1

1 Answers

0
votes

Try to specify android:largeHeap="true" in your manifest file Example

<application
    android:name=".MyApplication"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:screenOrientation="nosensor"
    android:largeHeap="true"