Mimminito
Mimminito

Reputation: 2843

Android ActionBar Tabs - ListFragment Issue

I have an application which has two Tabs. Both of these are ListFragments. The first Tab uses a CursorLoader to bind the data to the list, the data comes from a Service. The second Tab has nothing in it so far, its just a blank ListFragment.

Now, when I start up the application, and the service retrieves the information, all is good! The ListFragment has its data populated and everything works great. When I switch to the second Tab, I can just see a Loading Wheel, which is fine.

The issue comes when I switch back to the first Tab. When the service is started, and starts pulling down the data, I can see that its pulling it down in my logs, but nothing appears in my ListFragment. Its just blank, and its like the CursorLoader is not attached anymore.

The next weird thing, is when I close the application and relaunch it, the data is suddenly there in the list! But the bug again occurs when switching.

Any ideas on this? Its really bugging me!

Upvotes: 3

Views: 754

Answers (1)

Adam Lear
Adam Lear

Reputation: 38768

You have to call getLoaderManager.destroyLoader() when the fragment is removed.

Upvotes: 2

Related Questions