Question

I want to start multiple instances of the same (ExpandbleList-)activity using different parameters, so different data is loaded in the lists. These lists are in different tabs of a TabActivity.

So far it works, but when I update the information in one list, then return to the second list and click on one of the items (or change the screen orientation) this list is repopulated with data from the other list.

How can I start the activities so that they don't interfere with each others data?

Was it helpful?

Solution

By default, each Activity will be a new instance. Did you accidently set "single top" in the manifest for this Activity? Did you set up static (so, shared) members in the Activity which should not be static? How you instantiate the "different" Activity's personality; by giving Extras to the Intent?

OTHER TIPS

Activity will not be a new instance, that is why they have the resume and pause methods. I was trying to start a new Intent from a service that was started by a broadcast receiver. A completely different thread than the Main/UI thread. Worked fine unless that had already been run by the user then I got the following error for trying to create a new Intent even with the flag Intent.FLAG_ACTIVITY_NEW_TASK. android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view heirarchy can touch its views.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top