0
I am developing an application in android studio and need to solve this problem.
I am using an internal database in Sqlopenhelper to store the products chosen by the user and show in a shopping cart. There are at most three products that the user can buy by delivery.
But what is happening is that the first time the user logs into the app it works perfectly and only allows the user to add at most three products in the shopping cart. However, if by chance the user already has with their full cart and press the "Home" button of the device and come back in the app again, it automatically allows the user to add three more products beyond the limit and I do not want this.
What I want is to know what I need to do to "reset" the app, if by chance, the user click the Home button of the device and not the right button for it to exit?
There is some specific method that when finalizing the app it re-remembers all memory?
I’ve heard of the onDestroy(){...}
, But I think he’s just a detritus from Activity and that’s not what I want. I want the user to be independent of Activity, if the app closes, it resets.