i want to close or stop running application when i exit from main screen means very first layout of application when i press back button in android. i use this but my application is running on background
        @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
       // Splash screen view
        setContentView(R.layout.splash);
        }
 **public void onDestroy()
  {
 super.onDestroy();
 System.runFinalizersOnExit(true);
 System.exit(0);
    }**
                get the process ID of your application, and kill that process onDestroy() method
@Override
public void onDestroy()
 {
    super.onDestroy();
    int id= android.os.Process.myPid();
    android.os.Process.killProcess(id);
 }
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With