android - Which handler class to import? for webview twice backpress exit app -
i want go on app on 1 time press.. , if key presesd twice, want app exit. got following code on internet , stackoverflow.
@override public void onbackpressed() { if (doublebacktoexitpressedonce) { super.onbackpressed(); return; } this.doublebacktoexitpressedonce = true; toast.maketext(this, "please click again exit", toast.length_short).show(); new handler().postdelayed(new runnable() { @override public void run() { doublebacktoexitpressedonce=false; } }, 2000); }
now don't know handler class should imported here? either
`java.util.loggin.handler
or
`android.os.handler
the second 1 (android.os.handler). can't explain more. 1 handler @ operating system level, , other used logging purposes (it's on package names, though)
Comments
Post a Comment