onbackpressed close the app in android

Solutions on MaxInterview for onbackpressed close the app in android by the best coders in the world

showing results for - "onbackpressed close the app in android"
Willam
19 Jan 2017
1@override
2public void onBackPressed(){
3Intent a = new Intent(Intent.ACTION_MAIN);
4a.addCategory(Intent.CATEGORY_HOME);
5a.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
6startActivity(a);
7}
8