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)
 

sorex

Expert
Licensed User
Longtime User
how many images and what are their dimensions?

do you reduce the size to what it is on screen to gain memory?
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
how many images and what are their dimensions?

do you reduce the size to what it is on screen to gain memory?

only one image is used. it is in .png format, 128 * 128 dimension.

But the thing is most if the time is all are working fine. But in some instance it got and unfortunately stops error (out of memory).
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
How often are you loading the image ?
The related code is
B4X:
Sub Activity_Create(FirstTime As Boolean)

   
AppIcon.Initialize(File.DirAssets,"icon.png")
bmp.Initialize(File.DirAssets,"back1.png")
AB.Initialize(Activity,Null   ,Me,"ActionBar1")
AB.ABHeight = 48dip
AB.ABIcon = AppIcon
AB.AbTitle  = " INVOICE"
'AB.CreateNavigationDrawer("Main",Null)
AB.ABBackColor  = Colors.RGB(122, 226, 255)
AB.AddMenuItem("Version" ,BlnkBmp ,"Version")
'AB.AddNavigationDrawerItem("NDrawer" ,AppIcon,"NDrawer")
AB.AddActionButton ("Back",bmp,"Back")
AB.MenuItemBackColor = Colors.RGB(122, 226, 255)

SQL1.Initialize(DBFileDir, DBFileName, False)
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
What size in pixels is back1.png ?
I would suggest, as a first step, to declare bmp as a Process_Global variable and initialize it with
B4X:
If FirstTime Then    
bmp.Initialize(File.DirAssets,"back1.png")
End If
Every time you turn the device or use another Activity and come back you define a new bitmap.
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
What size in pixels is back1.png ?
I would suggest, as a first step, to declare bmp as a Process_Global variable and initialize it with
B4X:
If FirstTime Then  
bmp.Initialize(File.DirAssets,"back1.png")
End If
Every time you turn the device or use another Activity and come back you define a new bitmap.

The Pixel size of Back1 is 140 * 94.
And I use 'Project Attributes'
#SupportedOrientationsPortrait
so it can't be rotated.

I use the above bitmap code in every activity.
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
Still I got the error message in different activity
In that code I didn't use the back1.png
I used only icon.png
as above


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.invoice._activity_create(invoice.java:406)
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.invoice.afterFirstLayout(invoice.java:100)
at SFA.System.invoice.access$100(invoice.java:17)
at SFA.System.invoice$WaitForLayout.run(invoice.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)
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
when i opened/ load activities which have the bitmap for 9 times it gets out of memory.

how can I reuse the bitmap I loaded/initialized in several activities. I have 15 activity all have actionbar with bitmap of 48dip
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
how can I reuse the bitmap I loaded/initialized in several activities. I have 15 activity all have actionbar with bitmap of 48dip
Every time the same icon?

In main Process globals define a bitmap (dim bmp as Bitmap)
In main activity_create firttime = true you load the bitmap to the global var
in all activities you use then this global loaded bitmap instead of loading a new one each time
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
Every time the same icon?

In main Process globals define a bitmap (dim bmp as Bitmap)
In main activity_create firttime = true you load the bitmap to the global var
in all activities you use then this global loaded bitmap instead of loading a new one each time


I define in the main process globals - dim bmp as Bitmap
in activity_create firsttime sub I did---
If FirstTime Then
bmp.Initialize(File.DirAssets,"icon.png")
End If​

then In activity1 or activity2 or ect....

when I use the "AB.ABIcon = bmp" , error message says
"Undeclared variable 'bmp' is used before it was assigned any value"

what I have done wrong I can get it.
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
DonManfred: You are correct. It should be main.bmp.
But still the same error.

I did like this.

I declared and initialized the bmp in the main activity
and I used it in the main activity as well as in the activity1 also as main.bmp

Then
I open main activity then from main to activity1 then
from activity1 to main then main to activity1 and so on.....
when the activity(either main or activity1) is loaded at 9th time the out of memory occurs.

now what might be the wrong..
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
Can you post the project as a zip file.

I made a new sample project as I attached.
when I load it main to activity and activity to main for approximately 50 times it get out of memory error.
(may be it is irritating to do 50 times since my image size is small. sorry for inconvenient. Hope you will understand. Because I can upload the project with large image file. Max uplaod is 512 kb)
 

Attachments

  • Bmp.zip
    501.1 KB · Views: 172
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
LogCat connected to: 05157df57d72d204
--------- beginning of main
--------- beginning of system
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = true **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **~i:** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **~i:** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **~i:** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **~i:** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
works fine here....
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
I tried twice

LogCat connected to: BX903DN8S3
--------- beginning of /dev/log/system


--------- beginning of /dev/log/main


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = true **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = true **


** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
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 b4a.example.activity1._activity_create(activity1.java:357)
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 b4a.example.activity1.afterFirstLayout(activity1.java:100)
at b4a.example.activity1.access$100(activity1.java:17)
at b4a.example.activity1$WaitForLayout.run(activity1.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)
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = true **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
** Activity (activity1) Resume **
** Activity (activity1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (activity1) Create, isFirst = false **
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 b4a.example.activity1._activity_create(activity1.java:357)
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 b4a.example.activity1.afterFirstLayout(activity1.java:100)
at b4a.example.activity1.access$100(activity1.java:17)
at b4a.example.activity1$WaitForLayout.run(activity1.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)
 
Upvote 0

fasilosman

Active Member
Licensed User
Longtime User
Now also I tried. you may try with large bitmap file to generate it quickly
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Create, isFirst = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = true **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


** Activity (activity1) Resume **


** Activity (activity1) Pause, UserClosed = true **


** Activity (main) Resume **


** Activity (main) Pause, UserClosed = false **


** Activity (activity1) Create, isFirst = false **


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 b4a.example.activity1._activity_create(activity1.java:357)
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 b4a.example.activity1.afterFirstLayout(activity1.java:100)
at b4a.example.activity1.access$100(activity1.java:17)
at b4a.example.activity1$WaitForLayout.run(activity1.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)
 
Upvote 0
Top