Reputation: 12605
I am calling an Intent with String Extra from Activity A -> Activity B . That works great.
What I'm asking is
When navigate from Activity B -> Activity C and click back, in most cases the activity will be resumed but what if the activity got destroyed by the system? It will be recreated I know but will getIntent() be empty in that case?
Upvotes: 2
Views: 706
Reputation: 340
Answering your question: No, it will not be empty.
If you recall a little about the basics of Android you will remember that you can rely on the Extras to send information from an Activity to another through the Intent. If that intent could become empty after a low memory/whatever then you would have lost those Extras as well and you wont be able to successfully recreate the Activity.
Check also this answer for more info: in Android if OS kills my application, will getIntent() return the Intent with the same extras?
Upvotes: 1
Reputation: 10948
Note that i cant make sure this answer is correct because this is only based on my experience. Feel free to comment.
When navigate from Activity B -> Activity C and click back, in most cases the activity will be resumed but what if the activity got destroyed by the system? Will getIntent() be empty in that case?
I have been in a case where the activities must run sequentially, means whatever happens user must be go to activity B (from C - in your case) when onBackPressed
fired.
I put some log
in onPause
and onDestory
to see if my apps removed by the OS because it needs some free memory. Then, i test it with my old phone with low RAM (first generation HTC desire) and open a lot apps to make sure the RAM usage will be full.
The result?
Yes, my old phone destroyed my apps (from logcat
). Fortunately, after my current activity restarted, the onBackPressed
is still working fine (going back to previous activity).
Upvotes: 0