When I press the log out button and come to start(main) screen and when I press the back button from main screen it comes to 2nd screen. but, i want to close the application on click of back button from main screen and close all the activities before that. while doing research I found,
Intent intent = new Intent(this, Home.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
finish();
but its not satisfying my requirement.