I am working on an application in which there are several actions. One activity begins the next. To share some values, I use a custom application implementation (I'm talking about android.app.Application) called MyApplication.
As we all know, the Android system kills the application if it needs more space. But this leads to a problem:
- I open the application and use it just like any other application.
- I close it (Main button) and use other applications.
- The system will kill my application because it will lose memory
- When I open my application again, he wants to open the last action that I used, and my power is closed, because the values ββin MyApplication are null
It is strange that the system destroys my application, but it looks like it remains active. I really donβt understand why this is happening because the application is not like the life cycle.
What I want to have:
When MyApplication (the whole application, not just the activity) is killed, I want the last actions to be killed. Therefore, when I open the application again, it starts the main work provided by manifest.xml.
or
Values ββin MyApplication are saved and not lost if the application is destroyed. (I'm talking about a few objects, so I think that the general settings will not work).
I donβt want to use the service to bind my actions, but is there a way to tell the system that my last activity used depends on the application context?
I hope you understand what my problem is, and someone can help me with this.
source
share