Occasional Error

Bachrock

Member
Licensed User
Longtime User
Hi,

I am using the Asynstreamstext example in a project that I put together and for the most part it is working great. However occasionally when I exit the project using the "BackArrow" on my tablet and then open the project back up I get this error.

"An error has occurred in sub:main_ast_newtext(java line:525) java.lang.RuntimeException: Object should first be initialized (Label).

Here is the code associated with that error.

Sub ast_NewText(Text As String)

Log("Text: " & Text)
Log(Text.Length)

Label2.Text = Text & " "
ast.Write("GOTIT") 'THIS NEEDS TO REMAIN BECAUSE IT COMPLETES THE HANDSHAKING

End Sub


Again this is not every time may 1 out of 5 or around there. If I use the Home key and come back it doesn't do it but obviously I know that this doesn't necessarly close the program like the back arrow does so I would see that as the difference. If I completely kill the program with a program killing app it doesn't do it either?

Any Ideas? Is there any way to do Error handling so that if it happens I could just direct it to end the sub? If I say continue on the error the project works fine with no problems.

Please let me know.

Thanks

Paul:sign0085:
 

Bachrock

Member
Licensed User
Longtime User
That is probably correct. Then I should load the layout in the Resume sub?
Or should I just not have it in the "If first time" logic.

Here is the code

If FirstTime Then
Activity.LoadLayout("pieprzak")
End If


If I re-load it on the Resume should I do something addition under the Activity Pause Sub?

Thanks

Paul
 
Upvote 0

Bachrock

Member
Licensed User
Longtime User
That is probably correct. Then I should load the layout in the Resume sub?
Or should I just not have it in the "If first time" logic.

Here is the code

If FirstTime Then
Activity.LoadLayout("pieprzak")
End If


If I re-load it on the Resume should I do something addition under the Activity Pause Sub?

Thanks

Paul

Well actually I just looked and I do have it in the Resume Sub
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Layouts should be loaded in activity create but outside of the first time loop as the views cannot be process_globals.

-------------------
Sent via Tapatalk
 
Upvote 0
Top