I think I have got the solution for this. Before using BitmapFactory.decodeFile() create a byte array of 16k and pass your byte array for temp storage in decoding process. It works for me.. Code: byte[] byteArrayForBitmap = new byte[16*1024];
BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inTempStorage = byteArrayForBitmap; imgBitmap = BitmapFactory.decodeFile(path,opt); On Feb 5, 12:14 am, Romain Guy <[email protected]> wrote: > Use less memory. > > > > On Wed, Feb 4, 2009 at 11:11 AM, Rohit <[email protected]> wrote: > > > So whats a good solution? > > > Rohit > > > On Feb 4, 11:07 am, Romain Guy <[email protected]> wrote: > >> Scaling the image down happens at drawing time. You are just using > >> images that are too large to begin with. > > >> On Wed, Feb 4, 2009 at 11:05 AM, Rohit <[email protected]> wrote: > > >> > I noticed that the OutOfMemoryError occurs a lot when you try to load > >> > an image that is larger than the view. Android needs to scale the > >> > image down to fit the view and that is when it seems to crash out as a > >> > result of the OutOfMemoryError. > > >> > Rohit > > >> > On Jan 26, 3:09 pm, blindfold <[email protected]> wrote: > >> >> > Check first, and think a bit. > > >> >> I stand by what I said. > > >> >> Regards > > >> >> On Jan 25, 8:30 pm, ad <[email protected]> wrote: > > >> >> > Check first, and think a bit. > > >> >> > On Jan 25, 2:49 pm, blindfold <[email protected]> wrote: > > >> >> > > How can this possibly help you? You are trying to allocate 61 MB > >> >> > > (3200*4800*4 bytes), which lies well above the 16 MB heap limit. I > >> >> > > tried once to allocate, say, 12 MB at program startup to keep > >> >> > > Android > >> >> > > from all the time bumping into the heap limit and possibly crashing > >> >> > > as > >> >> > > a result in case its memory management is not 100% reliable, but > >> >> > > trying to allocate 61 MB should not offer any benefit? > > >> >> > > Regards > > >> >> > > On Jan 25, 2:23 pm, ad <[email protected]> wrote: > > >> >> > > > YES YES YES!!! > >> >> > > > I've found solution for that bug. > >> >> > > > It's tricky but it works. > >> >> > > > Place that on the begining of your code. > > >> >> > > > try{ > >> >> > > > BitmaptmpBitmap > >> >> > > > =Bitmap.createBitmap > >> >> > > > (3200, 4800, > >> >> > > > Config.ARGB_8888); > >> >> > > > }catch(Throwable e){ > >> >> > > > e.printStackTrace(); > >> >> > > > System.out.println("CATCHED !!!!"); > > >> >> > > > } > > >> >> > > > I was fighting with that about 4 days. > >> >> > > > Hope anyone is happy now, that was hell. > > >> >> > > > Regards, > >> >> > > > avram. > > >> -- > >> Romain Guy > >> Android framework engineer > >> [email protected] > > >> Note: please don't send private questions to me, as I don't have time > >> to provide private support. All such questions should be posted on > >> public forums, where I and others can see and answer them > > -- > Romain Guy > Android framework engineer > [email protected] > > Note: please don't send private questions to me, as I don't have time > to provide private support. All such questions should be posted on > public forums, where I and others can see and answer them --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

