[android-developers] Re: out of memory error & getWallpaper

2009-08-28 Thread Sables
Are we not able to reassign Bitmaps? I get OOM just by doing something like Bitmap a; a = network.downloadimage(); a = network.downloadimage(); a = network.downloadimage();// <-- crash Do I have to : a.recycle() ; a= null; everytime? On Aug 25, 2:25 pm, freeanderson wrote: > I guess nobody

[android-developers] Re: out of memory error & getWallpaper

2009-08-24 Thread freeanderson
I guess nobody reported my case. I've solved like below. See my case. ... Bitmap dummy = Bitmap.createBitma(1, 1, Config.RGB_565); Bitmap a = Bitmap.createBitma(100, 100, Config.RGB_565); Canvas c = new Canvas(a); ...c.draw(..) ... a.recycle(); c.setBitmap(dummy); // This is key point. Ve

[android-developers] Re: out of memory error & getWallpaper

2009-08-22 Thread sameer
Hi, I am getting the following logs when i am changing the wallpaper for Homescreen. Even i am recycling the bitmap is done when the wallpaper changes in OnWallpaperChanged(). Still i m getting the bellow error. 03-26 05:02:16.829: INFO/AC(1340): setWallpaper(InputStream 03-26 05:02:16.840: INF

[android-developers] Re: out of memory error & getWallpaper

2009-08-22 Thread sameer
Hi Nivek, Can you please tell me the solution for the problem attempt to use recycled bitmap Any solution please let me know. Your reply will be highly appreaciated Thanks and Regards Mohammed Sameer On Aug 17, 11:53 pm, Nivek wrote: > When you change the device orientation, you app is close

[android-developers] Re: out of memory error & getWallpaper

2009-08-22 Thread sameer
Hi Steve, PLease let me know how you fixed the belllow exeption run-time exception the next attempt to use recycled bitmap. I m also getting the same exeption trying to use a recycled bitmap android.graphics.bit...@43750030 Please reply back. Your reply will be highly appreciated. Thanks and

[android-developers] Re: out of memory error & getWallpaper

2009-08-20 Thread Nivek
Well, even if we should "normally" not call the recycle method, I see in ApiDemos some calls to this method : LabelMaker.java - line 281 SpriteTextRenderer.java - line 122 TriangleRenderer.java - line 106 I tried to solve a problem of memory allocation when loading big files (4000x3000 pics) yest

[android-developers] Re: out of memory error & getWallpaper

2009-08-20 Thread Hong
@Nivek THANK YOU the recycle() call works GREAT! ((BitmapDrawable)d).getBitmap().recycle(); I went through 10~15 photos w/o crashing! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To po

[android-developers] Re: out of memory error & getWallpaper

2009-08-20 Thread Hong
Here's the crash log file in case you are interested: 08-20 10:08:00.700: INFO/ActivityManager(18682): Displayed activity com.android.camera/.ImageGallery2: 1137 ms 08-20 10:08:01.220: VERBOSE/ImageGallery2(20461): /ImageBlockManager.onPause 08-20 10:08:01.280: DEBUG/Main(20546): /sdcard/dcim/Cam

[android-developers] Re: out of memory error & getWallpaper

2009-08-20 Thread Hong
I'm seeing the same out of memory problem. It's consistent on my G1 in a few tries. Basically I used the built-in intent to get the photo on my sdcard, and set it as the app's background: Drawable d = Drawable.createFromPath(filename); mainBg.setBackgroundDrawable(d); The filename is what passed

[android-developers] Re: out of memory error & getWallpaper

2009-08-17 Thread Nivek
Ok, so I should replace my calls to ImageView.getDrawable().getBitmap ().recycle() with ImageView.setImageBitmap(null) and let the GC do his job ? Or is the call to ImageView.setCallback(null) enough to get rid of both ImageView and Bitmap instances ? I'll try to track all my calls to Bitmap.recy

[android-developers] Re: out of memory error & getWallpaper

2009-08-17 Thread Romain Guy
Bitmap are eventually garbage collected. From the javadoc of the Bitmap class itself: "This is an advanced call, and normally need not be called, since the normal GC process will free up this memory when there are no more references to this bitmap." On Mon, Aug 17, 2009 at 3:14 PM, Nivek wrote:

[android-developers] Re: out of memory error & getWallpaper

2009-08-17 Thread Nivek
I'm sorry, I've certainly misunderstood something then, but... while coding an app dealing with bitmaps, this is what it looks like. Reading posts and blogs about memory management and use of bitmap led me to that conclusion, and carefully recycling bitmaps in my app allowed me to get rid of a lot

[android-developers] Re: out of memory error & getWallpaper

2009-08-17 Thread Marco Nelissen
On Mon, Aug 17, 2009 at 7:53 AM, Nivek wrote: > > When you change the device orientation, you app is closed and then > reopened. > > Android handles bitmaps a "special" way, you HAVE to explicitly > recycle them as soon as you don't need them anymore... or they stay > allocated in memory and NEVER

[android-developers] Re: out of memory error & getWallpaper

2009-08-17 Thread Flying Coder
Dianne, I suspect you are right, though I'm having a heck of a time tracking it down (i.e., I don't see any leaks). Thanks for the info on the wallpaper! Cheers, Steve On Aug 17, 12:47 pm, Dianne Hackborn wrote: > The wallpaper is loaded into each application that requests it.  It is only

[android-developers] Re: out of memory error & getWallpaper

2009-08-17 Thread Dianne Hackborn
The wallpaper is loaded into each application that requests it. It is only loaded the first time you ask for it, and the next time after it is changed to some other image. You are probably leaking memory. You can use the hat tool to look at your allocations -- search on this list, there have bee

[android-developers] Re: out of memory error & getWallpaper

2009-08-17 Thread Flying Coder
Hi Nivek, Unfortunately, doing recycle on the drawable returned by ContextWrapper.getWallpaper() results in a run-time exception the next time the app is launched: attempt to use recycled bitmap. Though curiously, if I launch the app again after receiving the exeption, it works fine. I.e.,

[android-developers] Re: out of memory error & getWallpaper

2009-08-17 Thread Nivek
When you change the device orientation, you app is closed and then reopened. Android handles bitmaps a "special" way, you HAVE to explicitly recycle them as soon as you don't need them anymore... or they stay allocated in memory and NEVER get freed. I have started to code an app which uses a set