Reputation: 506
I have a problem. When I use app it works good. But when I get called while using my application or I use another applications (browser, office, etc) WITHOUT CLOSING the application I am developing, when I try to use it again, it crashes. But if I close it and try to launch, it works fine. How can I solve this problem?
Upvotes: 0
Views: 47
Reputation: 506
I solved my crash using shared preferences. System Android cleaned all values from variables. So it caused crash. Now all values are stored in Shared Preferences and nothing losses and the app works stable.
Upvotes: 0
Reputation: 2276
To debug this, you need to understand what's happening.
When an application gets hidden by another one, it goes through different lifecycle stages than it does from a new launch.
You must be depending on some initialization that's happening during the regular launch lifecycle stages.
This could be for several reasons. Maybe your app cleans something up when it gets hidden, that isn't reinitialized when it's visible again, for example.
Upvotes: 1