Hello All,
I have a small code that questions the user to confirm to exit the Application and I am getting a strange error, saying that the compiler cannot parse the dialog response
B4A 7.30
The Error in the Log window is :
B4X:
Error occurred on line: 1559 (Main)
java.lang.RuntimeException: Cannot parse: -1 as boolean
at anywheresoftware.b4a.BA.parseBoolean(BA.java:591)
...
The code that Causes it:
B4X:
Sub btnExit_Click
Msgbox2Async("Exit Application ?","TP-614","Yes","","No",Null,False)
If DialogResponse.POSITIVE Then
Activity.Finish
Else
Return
End If
End Sub
Sub btnExit_Click
Dim myResponse as Boolean = Msgbox2Async"Exit Application ?","TP-614","Yes","","No",Null,False)
If myResponse Then
Activity.Finish
Else
Return
End If
End Sub
Msgbox2Async("Question?", "Title", "Yes", "Cancel", "No", Null, False)
Wait For Msgbox_Result (Result As Int)
If Result = DialogResponse.POSITIVE Then
'...
End If
Msgbox2Async("Deseja Sair da Aplicação ?", "Zarph TP-6X4", "Sim", "", "Não", Null, False)
Wait For Msgbox_Result (Res As Int)
If Res = DialogResponse.POSITIVE Then
ExitApplication
End If
Msgbox2Async("Deseja Sair da Aplicação ?", "Zarph TP-6X4", "Sim", "", "Não", Null, False)
Wait For Msgbox_Result (Res As Int)
If Res = DialogResponse.POSITIVE Then
Activity.finish
End If
ExitApplication is a mistake. Android can treat the application as if it hung up.