Android Question OutOfMemoryError

fasilosman

Active Member
Licensed User
Longtime User
I get the Out of memory error occurs randomly in my all activity.
My all activity have the ahaActionBar and it has a bitmap.
Most of the time it works and the error occurs randomly in different different activities and I have find the exact reason.

Please help me in this regard

java.lang.OutOfMemoryError


at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:640)
at android.graphics.Bitmap.createBitmap(Bitmap.java:620)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:76)
at at.ahadev.b4a.ahaActionBar.ahaactionbar._v0(ahaactionbar.java:262)
at SFA.System.selretailer._activity_create(selretailer.java:418)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at SFA.System.selretailer.afterFirstLayout(selretailer.java:100)
at SFA.System.selretailer.access$100(selretailer.java:17)
at SFA.System.selretailer$WaitForLayout.run(selretailer.java:78)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:4787)


at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:556)
at dalvik.system.NativeStart.main(Native Method)
 

fasilosman

Active Member
Licensed User
Longtime User
Works fine here after more than 300 activity changes.
Again, what size is your bitmap in pixels ?
The original file not the size of the view.
You say you cannot upload it.


My original project has 8 bitmap with 128*128 pixels sizes.

But the project I upload is not working after 50 activity changes. (the original project gets the error on 9th activity change)
I can't figure it out the problem.
I use xperia s (LT26i) for the testing purpose.
I don't know how to monitor the memory usage.

If you can guide me how to check it. I may do it.

Thank for the support
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
Dear All,

I have found a solution. I commented the following line and it works fine for 100 activity change and so on.

'AB.AddNavigationDrawerItem("NDrawer" ,Main.AppIcon,"NDrawer")

But I don't know the reason.

If any body found the reason. It will be helpful to me and others.

Thanks every one for the support
 
Upvote 0
Top