Good, I have a problem with my application, when I open an activity and it is finished doing what is required with that activity, it is passed to the other, however, if the user presses the back button of his device he returns to the previous activity, which should be destroyed when going to the next one, how can I solve this?
A clearer example:
I enter my login activity (activity) - > MainActivity (fragment) when I hit the back button, it returns me to the login, that is, when it passes to the next activity it is not destroyed, how can I delete that window from the memory so that it can not be accessed?