Question

I searched for my specific question and I couldn't find an answer of my problem.

On my app, my main activity has a tab host with 3 tabs. All three tabs have a list view with items.

The tab1 list view items are related to both tab 2 and tab 3 list view's items. One item on tab1 can correspond to one or more on tab 2 or 3.

Now the tricky thing:
When I click one item on each tab, I start a new activity to edit or even remove that item. After this action I need to change the listViews on all tabs, not only the inner activity tabbed that called for the action. The same is to say I need to refresh at least two tab activities (therefor the main activity). I can start the editing Activity with a startActivityForResult() and get the result of the action and update the current activity/tab). Now the problem is, I can't pass to the main activity any information to refresh the whole content. I thought about starting the main activity with data, when I update the contents but then it starts a new one, and when the user clicks to exit the app there's one (or more, depending on the number of actions perfomed) main activity on the background.

How can I update the main activity? How do I signal the main activity from inside an activity called on a tabbed activity? If I only needed to refresh the inner tab, there would be no problem.

Thanks in advance

Was it helpful?

Solution

If your tabs area actually activities and only one is visible at a time what you can do is to ise the on Resume method which is called when the new activity becomes visible you update it. Also you can use ontabchangedlistener.

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