Android Question How to close B4XMainPage

Sergey_New

Well-Known Member
Licensed User
Longtime User
Tell me how to close the application using btExit located on B4XMainPage in the same way as:
B4X:
Private Sub B4XPage_CloseRequest As ResumableSub
    Dim sf As Object = xui.Msgbox2Async ("Close?", "Title", "Yes", "Cancel", "No", Null)
    Wait For (sf) Msgbox_Result (Result As Int)
    Log (Result)
    If Result = xui.DialogResponse_Positive Then
        Return True
    End If
    Return False
End Sub

Sub btExit_Click
    '???
End Sub
 

Sergey_New

Well-Known Member
Licensed User
Longtime User
Thanks!
But I need to execute the same Msgbox2Async code, but write it twice.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
How about:
B4X:
Sub btExit_Click
    Wait For (B4XPage_CloseRequest) Complete (Resp as Boolean)
    If Resp Then B4XPages.ClosePage(Me)
End Sub
 
Last edited:
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
B4X:
Sub btExit_Click
	Dim sf As Object = xui.Msgbox2Async ("Close?", "Title", "Yes", "Cancel", "No", Null)
	Wait For (sf) Msgbox_Result (Result As Int)
	If Result = xui.DialogResponse_Positive Then B4XPages.ClosePage(Me)
End Sub

I was too slow!
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…