Created
November 24, 2022 08:42
-
-
Save ibrahim-mrq/1ca81b173f1e7834de619d414514256e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override fun onBackPressed() { | |
| if (backPressedTime + 2000 > System.currentTimeMillis()) { | |
| backToasty!!.cancel() | |
| super.onBackPressed() | |
| return | |
| } else { | |
| backToasty = Toast.makeText(this, getString(R.string.back_exit), Toast.LENGTH_SHORT) | |
| backToasty!!.show() | |
| } | |
| backPressedTime = System.currentTimeMillis() | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment