Reputation: 31963
from class B(class that works in background) someone do this code NOTE: the activity A is already in the front, visible and running
context.startActivity(createIntent(context, A.class));
I could not get it why ?, what is the point ? I mean this is not for starting the activity, cause the activity has been already started. Also note that without this the program it is not working. so obviously with this code there is some kind of 'refresh' made on the activity.
So my question is which methods are called on the activity when the activity is running and new intent for that activity has been fired ? and what is the point of this kind of programming whatsoever . . .
Thanks
Upvotes: 1
Views: 610
Reputation: 24233
Such intents will be received in the onNewIntent()
callback of the Activity
class. You can use such method when you expect the activity to be launched from multiple points. Like from a service. The activity is paused on receiving such intent.
Upvotes: 1
Reputation: 21
well, it depends on the intent flags and launchmode of activity A. if A is single task, its onNewIntent would be invoked. Most likely, a new instance of activity A is being created. if not, post the intent flags and manifest of A
Upvotes: 2
Reputation: 24021
I guess you are making some changes in the data or UI which are taking effect as you are restarting it ... use the Handler
to update data or UI in your activity ..
you can also refer this doc:
http://developer.android.com/reference/android/os/Handler.html
Upvotes: 0