Skip to content

Instantly share code, notes, and snippets.

@malikkurosaki
Last active November 3, 2019 01:43
Show Gist options
  • Save malikkurosaki/d7ef6f9e76af64d4548696c835927a37 to your computer and use it in GitHub Desktop.
Save malikkurosaki/d7ef6f9e76af64d4548696c835927a37 to your computer and use it in GitHub Desktop.
membuat pess lagi untuk kemabali

tekan lagi untuk kembali

deklarasinya

keluar = Toast.makeText(getApplicationContext(), "Press back again to exit", Toast.LENGTH_SHORT);

di backpressnya

 @Override
   public void onBackPressed() {
       if (keluar.getView().isShown()) {
           keluar.cancel();
           super.onBackPressed();
       } else {
           keluar.show();
       }    
   }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment