Pedro Caldeira Active Member Licensed User Longtime User Jan 25, 2019 #1 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 : Code: 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: Code: Sub btnExit_Click Msgbox2Async("Exit Application ?","TP-614","Yes","","No",Null,False) If DialogResponse.POSITIVE Then Activity.Finish Else Return End If End Sub Thanks
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 : Code: 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: Code: Sub btnExit_Click Msgbox2Async("Exit Application ?","TP-614","Yes","","No",Null,False) If DialogResponse.POSITIVE Then Activity.Finish Else Return End If End Sub Thanks
Cableguy Expert Licensed User Longtime User Jan 25, 2019 #2 Pedro Caldeira said: Code: 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 Click to expand... This is pseudo code just to get you on the right track Upvote 0
Pedro Caldeira said: Code: 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 Click to expand... This is pseudo code just to get you on the right track
Pedro Caldeira Active Member Licensed User Longtime User Jan 25, 2019 #3 Now I get Code: java.lang.RuntimeException: Cannot parse: android.app.AlertDialog@844d73 as boolean It wants booleans but refuses it ? Last edited: Jan 25, 2019 Upvote 0
Now I get Code: java.lang.RuntimeException: Cannot parse: android.app.AlertDialog@844d73 as boolean It wants booleans but refuses it ?
MarkusR Well-Known Member Licensed User Longtime User Jan 25, 2019 #4 from docu Code: Msgbox2Async("Question?", "Title", "Yes", "Cancel", "No", Null, False) Wait For Msgbox_Result (Result As Int) If Result = DialogResponse.POSITIVE Then '... End If Upvote 0
from docu Code: Msgbox2Async("Question?", "Title", "Yes", "Cancel", "No", Null, False) Wait For Msgbox_Result (Result As Int) If Result = DialogResponse.POSITIVE Then '... End If
Pedro Caldeira Active Member Licensed User Longtime User Jan 25, 2019 #5 Code: 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 Worked Upvote 0
Code: 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 Worked
DonManfred Expert Licensed User Longtime User Jan 25, 2019 #6 Pedro Caldeira said: The code that Causes it: Click to expand... https://www.b4x.com/android/forum/pages/results/?query=Msgbox2Async Upvote 0
Pedro Caldeira said: The code that Causes it: Click to expand... https://www.b4x.com/android/forum/pages/results/?query=Msgbox2Async
DonManfred Expert Licensed User Longtime User Jan 25, 2019 #7 Pedro Caldeira said: Worked Click to expand... ok, i´m a bit late Upvote 0
kisoft Well-Known Member Licensed User Longtime User Jan 25, 2019 #8 Code: 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. Upvote 0
Code: 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.