Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7827029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:41:09+00:00 2026-06-02T09:41:09+00:00

I have an Activity that contains 12 ImageViews. In onCreate method I load 12

  • 0

I have an Activity that contains 12 ImageViews. In onCreate method I load 12 photos in these ImageViews using BitmapFactory.decodeStream(…).

When I come to this page and return back for 10 times I get the following Out of Memory Exception.

Why I get this error and how can I release resources to prevent this exception?

Thanks,

04-24 14:41:00.050: D/TextView(7586): Constructor - Got appearance for textColorPrimaryInverse
04-24 14:41:00.050: D/TextView(7586): Constructor -- Got mEditTextBackgroundColor
04-24 14:41:00.130: I/dalvikvm-heap(7586): Clamp target GC heap from 48.878MB to 48.000MB
04-24 14:41:00.130: D/dalvikvm(7586): GC_FOR_ALLOC freed 495K, 2% free 47950K/48775K, paused 44ms
04-24 14:41:00.130: I/dalvikvm-heap(7586): Forcing collection of SoftReferences for 404616-byte allocation
04-24 14:41:00.180: I/dalvikvm-heap(7586): Clamp target GC heap from 48.856MB to 48.000MB
04-24 14:41:00.180: D/dalvikvm(7586): GC_BEFORE_OOM freed 23K, 2% free 47926K/48775K, paused 48ms
04-24 14:41:00.180: E/dalvikvm-heap(7586): Out of memory on a 404616-byte allocation.
04-24 14:41:00.180: I/dalvikvm(7586): "main" prio=5 tid=1 RUNNABLE
04-24 14:41:00.180: I/dalvikvm(7586):   | group="main" sCount=0 dsCount=0 obj=0x40a54460 self=0x1ad5828
04-24 14:41:00.180: I/dalvikvm(7586):   | sysTid=7586 nice=0 sched=0/0 cgrp=default handle=1074742408
04-24 14:41:00.180: I/dalvikvm(7586):   | schedstat=( 14073874000 2242143000 19299 ) utm=1301 stm=106 core=1
04-24 14:41:00.180: I/dalvikvm(7586):   at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:493)
04-24 14:41:00.180: I/dalvikvm(7586):   at org.mabna.order.utils.Utilities.decodeFile(Utilities.java:1220)
04-24 14:41:00.180: I/dalvikvm(7586):   at org.mabna.order.businessLayer.db.BoInvProducts.getProductPhoto(BoInvProducts.java:107)
04-24 14:41:00.180: I/dalvikvm(7586):   at org.mabna.order.ui.ActProductsGallery.loadPageImages(ActProductsGallery.java:729)
04-24 14:41:00.180: I/dalvikvm(7586):   at org.mabna.order.ui.ActProductsGallery.selectItemInGallery(ActProductsGallery.java:611)
04-24 14:41:00.180: I/dalvikvm(7586):   at org.mabna.order.ui.ActProductsGallery.onCreate(ActProductsGallery.java:315)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.app.Activity.performCreate(Activity.java:4465)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.app.ActivityThread.access$600(ActivityThread.java:123)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.os.Looper.loop(Looper.java:137)
04-24 14:41:00.180: I/dalvikvm(7586):   at android.app.ActivityThread.main(ActivityThread.java:4424)
04-24 14:41:00.180: I/dalvikvm(7586):   at java.lang.reflect.Method.invokeNative(Native Method)
04-24 14:41:00.180: I/dalvikvm(7586):   at java.lang.reflect.Method.invoke(Method.java:511)
04-24 14:41:00.180: I/dalvikvm(7586):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-24 14:41:00.180: I/dalvikvm(7586):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-24 14:41:00.180: I/dalvikvm(7586):   at dalvik.system.NativeStart.main(Native Method)
04-24 14:41:00.180: D/skia(7586): --- decoder->decode returned false
04-24 14:41:00.180: D/AndroidRuntime(7586): Shutting down VM
04-24 14:41:00.180: W/dalvikvm(7586): threadid=1: thread exiting with uncaught exception (group=0x40a531f8)
04-24 14:41:00.180: E/AndroidRuntime(7586): FATAL EXCEPTION: main
04-24 14:41:00.180: E/AndroidRuntime(7586): java.lang.OutOfMemoryError
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:493)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at org.mabna.order.utils.Utilities.decodeFile(Utilities.java:1220)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at org.mabna.order.businessLayer.db.BoInvProducts.getProductPhoto(BoInvProducts.java:107)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at org.mabna.order.ui.ActProductsGallery.loadPageImages(ActProductsGallery.java:729)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at org.mabna.order.ui.ActProductsGallery.selectItemInGallery(ActProductsGallery.java:611)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at org.mabna.order.ui.ActProductsGallery.onCreate(ActProductsGallery.java:315)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.app.Activity.performCreate(Activity.java:4465)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.os.Looper.loop(Looper.java:137)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at android.app.ActivityThread.main(ActivityThread.java:4424)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at java.lang.reflect.Method.invokeNative(Native Method)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at java.lang.reflect.Method.invoke(Method.java:511)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-24 14:41:00.180: E/AndroidRuntime(7586):     at dalvik.system.NativeStart.main(Native Method)
04-24 14:41:01.350: I/Process(7586): Sending signal. PID: 7586 SIG: 9
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:41:10+00:00Added an answer on June 2, 2026 at 9:41 am

    Maybe, decode your images with the nearest size of your ImageViews (see this : Strange out of memory issue while loading an image to a Bitmap object)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an activity(say, MyActivity) that contains fragments, and i am using fragmentTransaction.replace(XX,YY) for
I have an activity that contains several user editable items (an EditText field, RatingBar,
I currently have a class called clientActivity that contains a finger paintig activity that
I have a workflow that contains a Pick activity. Each PickBranch is triggered by
I have a service that also contains an activity the problem is sometimes it
I have an activity that launches another activity with startActivityForResult method. I would like
I have an activity that lets the user load some data when they press
I have an Activity whose layout is in the file main.xml that contains a
I have a large activity that contains 100 or more buttons. But it's working
My situation is following. I have one Activity that contains three main parts. At

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.