Hy everybody,
This is my first class I have ever made. Maybe you know it from app like ES File Explorer: When you tap the backbutton a toastmessage appears with the text: 'Tap again to exit'. If you tap back again, the App will close. So i made this class to easy use this feature. (As I said earlier: this is my first class and i'm still working on it)
Example code:
> Updates <
Version 1.1:
- Timeout set to ~1.8 seconds
Version 1.2:
- Remove the Log() method
- Changed the Description
This is my first class I have ever made. Maybe you know it from app like ES File Explorer: When you tap the backbutton a toastmessage appears with the text: 'Tap again to exit'. If you tap back again, the App will close. So i made this class to easy use this feature. (As I said earlier: this is my first class and i'm still working on it)
Example code:
B4X:
Sub Globals
Dim D As DoubleTaptoClose
End Sub
Sub Activity_Create(FirstTime As Boolean)
D.Initialize ("Tap again to exit")
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If keycode = KeyCodes.KEYCODE_BACK Then
D.TapToClose
Return True
End If
End Sub
> Updates <
Version 1.1:
- Timeout set to ~1.8 seconds
Version 1.2:
- Remove the Log() method
- Changed the Description
Attachments
Last edited: