converting BACK to HOME

marcick

Well-Known Member
Licensed User
Longtime User
I would like when the user press the BACK button, the App behave like if he pressed HOME.
I know how intercept the BACK button, but I can't simulate the HOME.
This is my failed attempt:
B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean 
        
    If KeyCode= KeyCodes.KEYCODE_BACK Then
        Dim KC As Int
        KC = KeyCodes.KEYCODE_HOME
         Activity_KeyPress (KC) 
      Return True
   End If

End Sub

Any hints ?
Marco
 

ivanomonti

Expert
Licensed User
Longtime User

Hi Erel;

I need to disable and re-enable the home button, but not using the mode according kios

B4X:
Sub Activity_KeyPress (KeyCode As Int) As Boolean

  If KeyCode = KeyCodes.KEYCODE_BACK and disableback = true Then
  Select Msgbox2 ("Keypad lock back", "", "", "", "Close", Null)
  Case DialogResponse.NEGATIVE
  Return True
  Case DialogResponse.CANCEL
   Return True
  Case DialogResponse.POSITIVE
  Return True
  end Select
  end If

If KeyCode = KeyCodes.KEYCODE_HOME and disablehome = true Then
  Select Msgbox2 ("Keypad lock home", "", "", "", "Close", Null)
  Case DialogResponse.NEGATIVE
  Return True
  Case DialogResponse.CANCEL
   Return True
  Case DialogResponse.POSITIVE
  Return True
  end Select
  end If

  end Sub

Thank
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…