Android Question How to press back button from app

Discussion in 'Android Questions' started by Alberto Michelis, Jun 14, 2015.

  1. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    I have a MAIN module that calls the EDIT module to add or update records.

    This secuence works ok:
    I call the EDIT with StartActtivity(EDIT)
    In the EDIt, if I press the back button to cancel, then I return to the MAIN and if I press back button again I exit the app.

    This does not:
    In the EDIT, I have buttons for add edit or delete, when I finish the code the I go back to the MAIN with StartActivity(MAIN)
    NOw if I press back button in the MAIN i go back to the EDIT module.

    I suppouse it can be fixed by pressing the back button intead of the startactivity.

    How can I press the back button from my app? or are there any other way?

    Thanks
     
  2. klaus

    klaus Expert Licensed User

    Instead of StartActivity(MAIN) call Activity.Finish to close the EDIT Activity.
     
Loading...