android – cursor loader doesn't update in my swipe tab until I restart the application-ThrowExceptions

Exception or error:

I have an application with two activities the launcher activity has two swipe tabs and one of those uses the a simpleCursorAdapter and a cursorloader to populate the views from a database.

The code works fine when I am using a single activity and without the tabs. I mean I get updates data as the the database changes, but in this new design I only get updated data only after I restart the app.

Here is the scenario after the application starts I initiate the the loader and populate the listview in the tab , then I can start the second activity by clicking on one of the item in in the listview, the main activity that I can close by pressing on a button.

after closing the second activity I get back to the main activity and insert a row in my database ( and up to this point every thing is working fine , I can see that in the debugger)

But the problem is that I wont get the newly entered item on my screen unless I restart the app.

Even I swipe several times between my tabs nothing happens.

I have tried to restart my loader in my fragment callbacks but still no changes.

What is going wrong in my design?

How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *