views:

47

answers:

1

I have an application with a multi-instance activity. I would like each instance of the activity to appear in a new task and process.

Any suggestions on how to do this? By manipulating the manifest I can cause all instances of the activity to appear in a specific task and process, but I haven't found any way to cause each instance to appear in a different task and process.

(The requirement to have different tasks is that we want each instance of the activity to appear separately in the task list; the requirement for different processes is that each instance of the activity is backed by a chunk of native code with global state. We can't change either of these.)

+1  A: 

Well, you could use FLAG_ACTIVITY_MULTIPLE_TASK but the documentation is pretty clear that you should not use it for what you want to do. It's possible that you could end up with a bunch of Activitys that the user has no method of getting back too.

I suggest reexamining your app's architecture. Maybe you can store the link to the native state in a Local Service and have the activity fetch the correct one from it depending on what is in its Intent.

Qberticus
I think that solves the task side of things; thanks (I'm quite willing to implement my own task manager if it'll get all this stuff working).Unfortunately I'm still not getting each activity in its own process. There's no way round this; we need to do be able to have multiple concurrent activities, and each activity needs its own instance of the library, and the library is limited to one instance per process (and we can't change this).
David Given
You can try setting android:multiprocess="true" on the activity in the manifest. I've never used it and I'm not sure if it guarantees a new process or not.
Qberticus