The application that has created multiple screens,
when I’m surfing on the application button to return the phone does not work.
I wanted to turn the button back of the unit itself, with some conditions:
when you press the back button, he will return to the previous screen, just exit the program if we do not have more screen to come back.
And before returning to the previous screen or close the program it reset the variable x
I am not sure I understand your question correctly. But you can alter the behavior of the back button in your activity by overriding onBackPressed