Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

android java close app

 @Override
    public void onBackPressed() {
        AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);
        alertDialogBuilder.setTitle("Exit Application?");
        alertDialogBuilder
                .setMessage("Click yes to exit!")
                .setCancelable(false)
                .setPositiveButton("Yes",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int id) {
                                moveTaskToBack(true);
                                android.os.Process.killProcess(android.os.Process.myPid());
                                System.exit(1);
                            }
                        })

                .setNegativeButton("No", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {

                        dialog.cancel();
                    }
                });

        AlertDialog alertDialog = alertDialogBuilder.create();
        alertDialog.show();
    }
Comment

PREVIOUS NEXT
Code Example
Java :: find maven version 
Java :: spigot actionbar 
Java :: java get excectuon time 
Java :: java get mouse position on screen 
Java :: calculate age in days java 
Java :: install java apt 
Java :: Java how to copy file 
Java :: recyclerview dependency java android 
Java :: objectmapper maven dependency 
Java :: bukkit inventory set name 
Java :: get intent not working in fragment 
Java :: float to string java 
Java :: exit app android 
Java :: keyset sort java 
Java :: maven source option 5 is no longer supported use 7 or later 
Java :: how to force garbage collection in java 
Java :: SpEL define default 
Java :: listview refresh android adapter 
Java :: java get ram usage 
Java :: java double buffering jpanel 
Java :: spring context xml definition 
Java :: get long from date java 
Java :: -Xlint:deprecation 
Java :: feignException byteBuffer to string 
Java :: java string to int 
Java :: java swing button on click 
Java :: consolenausgabe java 
Java :: repeat password in joi 
Java :: java create set with values 
Java :: how to add animation to nivation component android 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =