Android Question Why Close the app couse app restart automatically?

Discussion in 'Android Questions' started by nickysuwandi, Jun 1, 2019.

  1. nickysuwandi

    nickysuwandi Member Licensed User

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

    Code:
    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
     
  2. kisoft

    kisoft Active Member Licensed User

    HI
    Do not use Exit Application. Do not do anything, the android will close the activity after some time.
     
    nickysuwandi likes this.
  3. MarkusR

    MarkusR Well-Known Member Licensed User

    Better use Msgbox2Async
     
    nickysuwandi likes this.
  4. nickysuwandi

    nickysuwandi Member Licensed 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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice