Most of us will finish activity or keep track of the activity stack and all.
But no need of this type of complex logic if you need just the same effect of user's back key press
You can use the android onBackPressed() method explicitly .
The default implementation simply finishes the current activity, but you can override this to do whatever you want.
The android implicitly call this method when the activity has detected the user's press of the back key.
So calling this explicitly will give the same effect