title: How to press back button in android programmatically?
body: <p>In my app I have a logout functionality. If user clicks logout it goes to home screen. Now I am  exiting my app by pressing back button. But what I want is I need to exit automatically(i.e Programmatically) as same like as back button functionality. I know by calling finish() will do the functionality. But the thing is it goes to the previous activity.</p>