I've developed an app that creates groups for meeting events and works this way:
- In a listview (that belongs to Fragment A managed by Activity A) the app shows all the groups. This listview is populated by an AsyncTask that makes an HTTP GET Request (using Apache HTTPClient) to an Restful WS.
- In this Activity (Activity A) the user can go to another Activity (Activity B) in order to create a new group. To create a new group the app use another AsyncTask that makes an HTTP PUT Request to the same WS.
- After the group's creation, the user is redirected back to the Activity A in order to see the available groups where the new group should be included.
The problem is i'm getting the same list that was presented in the item 1 from above. This list only refresh after i click the refresh button a couple of times as if it had some sort of cache.
Solutions that i've tried to avoid cache, unsuccessfully:
- Using Transactions (source) to make the inserts faster (i'm doing about 10/20 inserts for group) in the Database (i'm using InnoDB engine).
- Using SQL_NO_CACHE (source) to prevent MySQL from place the result in the cache (i'm using this to get the groups list - Activity A).
- Adding to the HTTP GET Request the following header "Cache-Control: no-cache" (source 1, source 2) (i'm using this to get the groups list - Activity A).
- Clearing the app cache (source) whenever the user leaves the Activity A so that when he returns from the Activity B gets the list of groups already with the new group included.
Only works if i try to get the groups list inside Activity B, when the user creates a new group. In this case the WS returns an updated list with the new group included. After that if I return to the Activity A the outdated list is shown again.
How can i prevent use cache in the Activity A?
Thanks