Android Question Why Close the app couse app restart automatically?

nickysuwandi

Member
Licensed User
Longtime User
i want to close the app when user click return button, using code below, but the app restart automatically.

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean
    If KeyCode = KeyCodes.KEYCODE_BACK Then
        If Msgbox2("Do you want to close?", "", "Yes","", "No", Null) = DialogResponse.POSITIVE Then
            ExitApplication 'App is exiting
        Else
            Return True
        End If
    End If
End Sub

if i change " Exit Application " to "Activity.Finish", the app will display blank screen and not close the apps.

Some Expert may help me, where is wrong in my code???

Thanks

Nicky
 

MarkusR

Well-Known Member
Licensed User
Longtime User
Better use Msgbox2Async
 
Upvote 0

nickysuwandi

Member
Licensed User
Longtime User
Thanks Kisoft and MarkusR, i had solve my problem.

the app display blank screen, because i am ExitApplication not in the first loading screen.
 
Upvote 0
Top