[android-developers] Re: OutOfMemoryException
How large are your images (not file size, but width*hight*bits-per-pixel) images are uncompressed when loaded so you need to budget your memory on the expanded size?
How many do you load the same time?
Do you unload bitmaps that you have finished using?
On Friday, July 6, 2012 5:16:17 PM UTC+1, Android Developer wrote:
-- On Friday, July 6, 2012 5:16:17 PM UTC+1, Android Developer wrote:
Hi,
I am working in a avatar like application that has lots of images more than 1000 where user can change any image at runtime. But its frequently running out of heap space and then crashed.
I checked this. http://developer.android.com/training/displaying-bitmaps/ index.html
But it didnt solve my problem. Even i have worker thread to update the image to UI.
Stack Trace :
07-06 21:54:45.707: E/AndroidRuntime(14405): java.lang.OutOfMemoryError
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.graphics.BitmapFactory. Thanks in AdvancenativeDecodeAsset(Native Method)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.graphics.BitmapFactory.decodeStream( BitmapFactory.java:483)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.graphics.BitmapFactory. decodeResourceStream( BitmapFactory.java:351)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.graphics.drawable.Drawable. createFromResourceStream( Drawable.java:773)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.content.res.Resources.loadDrawable(Resources.java: 1935)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.content.res.Resources.getDrawable(Resources.java: 664)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.widget.ImageView.resolveUri(ImageView.java:542)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.widget.ImageView.setImageResource(ImageView. java:315)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.os.AsyncTask.finish(AsyncTask.java:602)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.os.AsyncTask.access$600(AsyncTask.java:156)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.os.AsyncTask$InternalHandler.handleMessage( AsyncTask.java:615)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.os.Handler.dispatchMessage(Handler.java: 99)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.os.Looper.loop(Looper.java:137)
07-06 21:54:45.707: E/AndroidRuntime(14405): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-06 21:54:45.707: E/AndroidRuntime(14405): at java.lang.reflect.Method.invokeNative(Native Method)
07-06 21:54:45.707: E/AndroidRuntime(14405): at java.lang.reflect.Method.invoke(Method.java:511)
07-06 21:54:45.707: E/AndroidRuntime(14405): at com.android.internal.os.ZygoteInit$ MethodAndArgsCaller.run( ZygoteInit.java:784)
07-06 21:54:45.707: E/AndroidRuntime(14405): at com.android.internal.os.ZygoteInit.main(ZygoteInit. java:551)
07-06 21:54:45.707: E/AndroidRuntime(14405): at dalvik.system.NativeStart.main(Native Method)
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home