android java back button closeapp

Solutions on MaxInterview for android java back button closeapp by the best coders in the world

showing results for - "android java back button closeapp"
Alberta
07 May 2017
1public void onBackPressed(){
2Intent a = new Intent(Intent.ACTION_MAIN);
3a.addCategory(Intent.CATEGORY_HOME);
4a.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
5startActivity(a);
6}
7