dalvikvm-heap out of memory large size image

I searched on the internet but didn't get a solution. How do I get a Bitmap of a Large size image(13 Mb) from the path of an image in the SD card or phone memory?

I use this:

Bitmap b = BitmapFactory.decodeFile(path);

and get an exception on this line

Thanks.

Upvotes: 0

Views: 2724

Answers (2)

Nam ND
Nam ND

Reputation: 1

Use android:largeHeap="true" for solve this:

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher"
    android:largeHeap="true"

Upvotes: 0

This has to do with the Java Heap Size.

You can request a larger heap using the manifest on devices that are 2.3 or above.

See this Stack Overflow post for more information.

Upvotes: 1

Related Questions