I'm working on an Android application that starts from an activity that serves as the menu screen (I'll call this activity the menu activity). 

There is a button that moves the app to another activity where the user can enter their name (I'll call this activity the name activity), and then the app returns to the menu activity.

After entering my name, (I have now gone like this: menu - name - menu) when I press the back button, it goes back to the name activity, with the name still present in the EditText field.

I'd like to know if there's some way to change the back key's functionality to avoid going to the name activity, and instead return to the main activity (The hierarchy is - main - menu - name).

Also, is there some way I can prevent the name from being retained in the EditText?

Thanks in advance.