My App runs fine the first time it is launched. If use the back button to dismiss it, if I then re-launch it from its icon or from the currently running list, it is launched with FirstTime = False and subsequently the first time I try to update a Label.Text, it gives Error label should first be initialised, and "Unfortunately, APPNAME has stopped on the screen". Next time, it launches okay. This is 100% repeatable.
Having read various tutorials etc about the App life cycle I tried calling Activity.Finish in various ways to no avail. I have searched all morning on the forums without finding this exact topic. Please note: I've only been using B4a for a couple of weeks.
I include the source in a zip in case it's obvious (e.g. a variable declared in the wrong place). For what it's worth, the App is a look-alike of one I wrote last year in Embarcadero Delphi / Firemonkey. The phone is used to replace an old Windows PDA and gets a simple web page from our embedded system then parses it and puts it on the screen.
Thanks in advance for any help
Simon
Output is from a Release copy of the program...
Logger connected to: BCom Mobile B.V. EX-SM14
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
Process Globals
** Service (starter) Create **
** Service (starter) Start **
Globals
** Activity (main) Create, isFirst = true **
Activity_Create
** Activity (main) Resume **
Activity_Resume
Timer1_Tick
** Service (httputils2service) Create **
** Service (httputils2service) Start **
JobName = Job1, Success = true
JobName = Job1, Success = true
JobName = Job1, Success = true
JobName = Job1, Success = true
JobName = Job1, Success = true
** Activity (main) Pause, UserClosed = true **
Activity_Pause
Globals
** Activity (main) Create, isFirst = false **
Activity_Create
** Activity (main) Resume **
Activity_Resume
main_updatewifi (java line: 957)
java.lang.RuntimeException: Object should first be initialized (Label).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:38)
at b4a.example.main._updatewifi(main.java:957)
at b4a.example.main._timer2_tick(main.java:854)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)
Having read various tutorials etc about the App life cycle I tried calling Activity.Finish in various ways to no avail. I have searched all morning on the forums without finding this exact topic. Please note: I've only been using B4a for a couple of weeks.
I include the source in a zip in case it's obvious (e.g. a variable declared in the wrong place). For what it's worth, the App is a look-alike of one I wrote last year in Embarcadero Delphi / Firemonkey. The phone is used to replace an old Windows PDA and gets a simple web page from our embedded system then parses it and puts it on the screen.
Thanks in advance for any help
Simon
Output is from a Release copy of the program...
Logger connected to: BCom Mobile B.V. EX-SM14
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
Process Globals
** Service (starter) Create **
** Service (starter) Start **
Globals
** Activity (main) Create, isFirst = true **
Activity_Create
** Activity (main) Resume **
Activity_Resume
Timer1_Tick
** Service (httputils2service) Create **
** Service (httputils2service) Start **
JobName = Job1, Success = true
JobName = Job1, Success = true
JobName = Job1, Success = true
JobName = Job1, Success = true
JobName = Job1, Success = true
** Activity (main) Pause, UserClosed = true **
Activity_Pause
Globals
** Activity (main) Create, isFirst = false **
Activity_Create
** Activity (main) Resume **
Activity_Resume
main_updatewifi (java line: 957)
java.lang.RuntimeException: Object should first be initialized (Label).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:38)
at b4a.example.main._updatewifi(main.java:957)
at b4a.example.main._timer2_tick(main.java:854)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:179)
at anywheresoftware.b4a.objects.Timer$TickTack.run(Timer.java:105)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
at dalvik.system.NativeStart.main(Native Method)