Advertisement
Guest User

Untitled

a guest
Mar 28th, 2015
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public void quit() {
  2. int pid = android.os.Process.myPid();
  3. android.os.Process.killProcess(pid);
  4. System.exit(0);
  5. }
  6.  
  7. Intent i= new Intent(getapplicationcontext,TARGETACTIVITY.class);
  8. finish();
  9. startActivity(intent);
  10.  
  11. public void close()
  12. {
  13. Intent intent = new Intent(Intent.ACTION_MAIN);
  14. intent.addCategory(Intent.CATEGORY_HOME);
  15. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  16. startActivity(intent);
  17. }
  18.  
  19. System.exit();
  20.  
  21. try{
  22. -------
  23. -----
  24. ----
  25. }
  26. Catch (Exception e)
  27. {
  28. exception.printStackTrace();//using alert box to show your exception.
  29. finish(); //use this one of your Application it will close the application.
  30. }
  31.  
  32. Intent intent = new Intent(Intent.ACTION_MAIN);
  33. intent.addCategory(Intent.CATEGORY_HOME);
  34. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  35. startActivity(intent);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement