E
E
Evgeny Nizamiev2015-10-22 11:04:28
Android
Evgeny Nizamiev, 2015-10-22 11:04:28

How to make it so that when the application is reopened, an already created activity is launched?

In general, the problem is this. There is a main activity, I switch from it to another activity, turn off the application for some long time (I didn’t measure it for sure) and after that, if you open the application from the icon on the desktop, another instance of the main activity opens, instead of the activity on which the application was rolled up.
A rather "soapy" question, if without a code example, but I'm interested in the very principles of how to do this or where to read about it, please tell me.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Gamega, 2015-10-22
@gadfi

this is the normal behavior of the system.
this issue is described quite well in the e-legion school in one of the first lectures. You are unlikely to find something fundamentally new there, but the details are well disclosed there,
you can force the system not to kill the activity (without a guarantee, but enough), but why? just waste the battery in vain
if you really need to save the data and when you restart, immediately open the second activity and fill it with old data

T
Tiberal, 2015-10-22
@Tiberal

read about the activity attribute "android:launchMode"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question