2

I was working through the following tutorial, I need to create a bitmap with the following code:

cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

the width/height can be greater than 5000 , but that would cause an OOM error. I tried to create a seperate thread but that didnt work. Is this even possible ? Does createBitmap have a limit for width/height ?

monkey man
  • 51
  • 1
  • 6
  • see this link this may help you http://stackoverflow.com/questions/15313807/android-maximum-allowed-width-height-of-bitmap – N J Aug 21 '15 at 17:23

1 Answers1

0

Add in your AppManifest.xml in your application tag this code:

android:largeHeap="true"

This will try to prevent your app from causing OutOfMemoryError.

Hussein El Feky
  • 6,627
  • 5
  • 44
  • 57
  • I did not know about this. A link to the [documentation](http://developer.android.com/guide/topics/manifest/application-element.html#largeHeap) for the lazy. – Corey Ogburn Aug 21 '15 at 17:35
  • this will not prevent your app from crashing because of a large bitmap – tyczj Aug 21 '15 at 17:35
  • @tyczj It will try to prevent the app from crashing, but not on devices with such low memory. I know that... But that should at least help him. – Hussein El Feky Aug 21 '15 at 17:46