Android Question I don't know this problem or why my solution solved it.

Beja

Expert
Licensed User
Longtime User
Working on a commercial app, and during testing.. it runs normally the first time, then the second
it throws java-lang exception org in activity.create, then the third time runs normally without exception
error, the forth time error. in exact alternate pattern. (odd times normal even times error).
I removed the "If FirstTime and End If", and astonishingly the error disappeared.
Note: Activity.Finish in the activity.pause didn't solve the problem, only after I removed the if first time.

Any explanation appreciated.
 

stevel05

Expert
Licensed User
Longtime User
Without seeing the code it's impossible to say conclusively, but it sounds like you may be initializing and/or populating a Global variable (as opposed to a Process_Global variable) within the If FirstTime clause, which won't then get reinitialized/populated unless the app is destroyed.

It's an Android Lifecycle thing.
 
  • Like
Reactions: eps
Upvote 0

Beja

Expert
Licensed User
Longtime User
Thanks Klaus,
Thanks Steve

Klaus this is the code:
B4X:
If FirstTime Then
        admin.Initialize("admin")
        serial1.Initialize("serial1")
End If

Now on Steve's advice I moved the declaration to Process Globals and it worked.
 
Last edited:
Upvote 0
Top