Android Question Back button long click?

DonManfred

Expert
Licensed User
Longtime User
AFAIK no
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use a timer for that:
B4X:
Sub Process_Globals
   Private backTimer As Timer
End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
   If FirstTime Then
     backTimer.Initialize("backTimer", 1000)
   End If
End Sub

Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
   If KeyCode = KeyCodes.KEYCODE_BACK Then
     backTimer.Enabled = True
     Return True
   Else
     Return False
   End If
End Sub

Sub Activity_KeyUp (KeyCode As Int) As Boolean
   If KeyCode = KeyCodes.KEYCODE_BACK Then
     backTimer.Enabled = False
     Return True
   Else
     Return False
   End If
End Sub

Sub BackTimer_Tick
   Log("LongBack event")
   backTimer.Enabled = False
End Sub
 
Upvote 0
Top