Each application has a cap on how much memory it can be allocated. If you go beyond this, you will get this exception.
Try creating a Bitmap with smalled dimensions. On Fri, Nov 5, 2010 at 7:22 PM, sharktiger <[email protected]> wrote: > Hi, > In my app, I am creating a bitmap from its colors code like this : > > int width=getImageWidth(); > int height=getImageHeight(); > int[] array=getbitmap(); > int[] colorsAsIntegers = new int[width*height]; > int i = 0; > int j = 0; > > while (i<width*height*4) { > colorsAsIntegers[j] = Color.argb(array[i], array[i+1], array[i+2], > array[i+3]); > i += 4; > j++; > } > > myBitmap=Bitmap.createBitmap(colorsAsIntegers, > width, > height, > Bitmap.Config.ARGB_8888); > > And often I get the outofmemoryerror :( > So how can I use the BitmapFactory optimisation to avoid this problem? > because I don't have an input stream or a file, I only have an array > containing my pixels > > Thank you > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- Kumar Bibek http://techdroid.kbeanie.com http://www.kbeanie.com -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

