How to make single instance of Activity with different data passed through Intents in Android?
I want to make an Activity which should be created only once and then it should be updated based on certain values. First I tried to pass data through Intent but since I have made that activity as singleTask it do not get the new Intent object and uses the previous one.
What can be the way of passing the data to开发者_StackOverflow中文版 an Activity that is singleTask and needs to be updated on certain values?
If your activity is singleTask, you need to handle new intents in onNewIntent
method
What entity generates the new values? If it is a Service
then your Activity
can establish a communication channel, so the Service
can notify the Activity
with new data.
More info here.
精彩评论