Unfortunately, "App" has closed

padvou

Active Member
Licensed User
Longtime User
I start my application normally.
I work with it.
I exit it using Activity.finish
I start it again.
Error shows up:Unfortunately, "App" has closed
I click on OK
I start it again.
It works.
And so on...

Any ideas?
This log appears when it starts normally:
** Activity (main) Create, isFirst = true **
Warning: Panel.LoadLayout called with zero sized panel.
Warning: Panel.LoadLayout called with zero sized panel.
Warning: Panel.LoadLayout called with zero sized panel.
** Activity (main) Resume **
startService: class uop.destiny.httputils2service
** Service (httputils2service) Create **
** Service (httputils2service) Start **
This log appears when it fails to start:
** Activity (main) Create, isFirst = false **
Warning: Panel.LoadLayout called with zero sized panel.
Warning: Panel.LoadLayout called with zero sized panel.
Warning: Panel.LoadLayout called with zero sized panel.
clswheel_initialize (java line: 986)
java.lang.OutOfMemoryError
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:605)
at android.graphics.Bitmap.createBitmap(Bitmap.java:585)
at anywheresoftware.b4a.objects.drawable.CanvasWrapper.Initialize(CanvasWrapper.java:72)
at uop.destiny.clswheel._initialize(clswheel.java:986)
at uop.destiny.main._initwheeldata(main.java:4166)
at uop.destiny.main._activity_create(main.java:783)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at uop.destiny.main.afterFirstLayout(main.java:89)
at uop.destiny.main.access$100(main.java:16)
at uop.destiny.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4429)
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:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
at dalvik.system.NativeStart.main(Native Method)
 
This line :

java.lang.OutOfMemoryError

Looks like the culprit here.

You seem to be drawing bitmaps, have you ensured that A) they aren't too large and B) you're using BitmapSample to load them, etc..

I'd also take a look on here about Canvas definitions.
 
Upvote 0
Msgbox is displayed twice? Do you have a loop in that part of the code? It would be easier to help if you could post your project. Zip it from the use file menu first.
via Tapatalk
 
Upvote 0
I have a feeling that it has something to do with calling Msgbox which is a blocking dialog from within the menu callback routine.

Try setting a Menu_handler routine that moves the Msgbox out of the way.

So in Activity.Create:

Code: Copy
    Activity.AddMenuItem("About", "Menu_Handler")
    Activity.AddMenuItem("Visit Website", "Menu_Handler")
    Activity.AddMenuItem("Exit", "Menu_Handler")

Then as a Menu Handler, something like

Code: Copy
Sub Menu_Handler_Click

   Dim Send As String
   
   Send = Sender
   
   Select Send

        Case "About"
      eAbout

       Case "Visit Website"
                'Menu > Website
                Dim p As PhoneIntents
                StartActivity(p.OpenBrowser("http://www.abhisoft.net"))

       Case "Exit"
                'Menu > Exit
                StopService(Service1)
                ExitApplication

   End Select
End Sub

Sub eAbout
               Msgbox("My App 1.0" & CRLF & "By Author Name" & CRLF & "Website: www.abhisoft.net", "About")
End Sub

[Edit] Although on testing your app, it doesn't fail on either Bluestacks or my HTC device. Is that all of your code, or is there some more that might be causing the issue?
 
Last edited:
Upvote 0
i have also got this error in my app.

here is what i am doing -
1. I added 3 menus. About, Website, Exit
2. Coded events for that
3. In About menu, i have coded a msgbox displaying my app info.

here is where the error occurs, it occurs randomly. user clicks the about menu, msgbox is displayed twice and then a error msg Unfortunately, App has closed.

No, you might have the same symptoms, but you almost certainly won't have the same problem.

Please start another thread, for your problem. Otherwise the two will get mixed up.
 
Upvote 0
Back
Top