In my application, I want to control the hardware back button. That means in my app there are four or five activity. Now suppose I move from one activity to another.
Now in my case when I press the hardware back button I want my app to exit from any activity where I have been but in my app when the press this back button than it doesn’t exit my app until it reaches the first activity… so my question is that what should I do so that when I press the hardware back button it will exit my app… please suggest me.
Try this: