Starting multiple instances of the same Activity from Service?

Service will take the flag FLAG_ACTIVITY_NEW_TASK to start the activity but here you can try like this: Set the instance of the handler of the activity of which you want multiple instances, in the service When you want the new instance of the activity use handler. SendMessage(msg) and on receiving this msg in your activity, start this activity again.

Service will take the flag FLAG_ACTIVITY_NEW_TASK to start the activity but here you can try like this: Set the instance of the handler of the activity of which you want multiple instances, in the service. When you want the new instance of the activity use handler. SendMessage(msg) and on receiving this msg in your activity, start this activity again.

A hack.. but it may work. Thanks. – Ovidiu Latcu Sep 30 at 13:55.

Otherwise I would use normal popup's (AlertViews) instead of starting new activities all the time. If the app works in the background, you could tell the user with the first popup that your app has found one or more malfunctions and that he should activate the app for more details.

It was so simple. There is the flag FLAG_ACTIVITY_MULTIPLE_TASK which according to the documentation : Used in conjunction with FLAG_ACTIVITY_NEW_TASK to disable the behavior of bringing an existing task to the foreground. When set, a new task is always started to host the Activity for the Intent, regardless of whether there is already an existing task running the same thing.

Was exactly what I need. Thanks and sorry for answering on my question. It is not a habit.

:).

I want to start multiple instance of the same Activity class from a Service. The reason I'm doing this, is because I have a Service that runs a "scan" daily, and if it finds any malfunctions it should display a popup for each malfunction. The Activity that I'm starting is more like a Dialog, has a Dialog theme to display info about the malfunction.

PROBLEM: to start the Activity from a Service I need the FLAG_ACTIVITY_NEW_TASK which somehow cancels the launchMode="standard" from the manifest, and gives me just one Activity even if I try to start multiple diffrent instances. Is there anyway in which I can achieve this?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions