Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android double click to exit

private var doubleBackToExitPressedOnce = false
override fun onBackPressed() {
        if (doubleBackToExitPressedOnce) {
            super.onBackPressed()
            return
        }

        this.doubleBackToExitPressedOnce = true
        Toast.makeText(this, "Please click BACK again to exit", Toast.LENGTH_SHORT).show()

        Handler(Looper.getMainLooper()).postDelayed(Runnable { doubleBackToExitPressedOnce = false }, 2000)
    }
Comment

PREVIOUS NEXT
Code Example
Java :: list of integers in java 
Java :: find minimum in array java 
Java :: icon label java 
Java :: jdbc interface 
Java :: java declare a list 
Java :: java android edit text set value 
Java :: java sum of array elements 
Java :: glide library in android studio 
Java :: each character in string java 
Java :: how to import class from another file in java 
Java :: spring websocket allow origin 
Java :: BST in java 
Java :: all installed java 
Java :: java print formatted string 
Java :: how to add chips dynamically android 
Java :: How to efficiently find the longest common subsequence of two strings, in Java? 
Java :: retrofit post header 
Java :: Android Bitmap to Base64 String 
Java :: tomcat 9 default username and password 
Java :: get index of element java 
Java :: how to make priority queue of pairs in java 
Java :: android dialog box example 
Java :: java stringbuilder 
Java :: linear search algorithm java 
Java :: java instanceof 
Java :: java date and time 
Java :: Quick Sort Java Implementation 
Java :: java php object 
Java :: room library android 
Java :: hashmap get value by key java 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =