Reputation: 3362
I'm developping an application in android which consumes a wcf web-service.
What I currently want to do is implement a refresh button,
In case the user exits the application and he is currently in an activity that may be projecting the "dirty" data from the service.
I reload activity from a thread.
The thread is also responsible for consuming the wcf and re-providing the data.
So I start the new (same)activity from this separate thread and I finish the current activity from the ui-thread of the activity.
The thing is that this doesn't work well all the time,meaning sometimes the ui-thread finishes first so I go one activity back before the same is reloaded.
I tried to put a sleep but the thing is that it won't show the activity which is started from the separate thread before the time elapses.
Also I don't want to try different time-periods since this is obviously depended on the data from the wcf so it won't work for every time.
My question is how can I synchronize these actions?
Upvotes: 0
Views: 250
Reputation: 2436
here from below link you can download the sample application of parsing that implemented refresh - like functionality
http://developer.android.com/training/basics/network-ops/index.html
Upvotes: 1