implementing refresh-like button on android
<p>I'm developping an application in android which consumes a wcf web-service.</p>

<p>What I currently want to do is implement a refresh button,</p>

<p>In case the user exits the application and he is currently in an activity that may be projecting the "dirty" data from the service.</p>

<p>I reload activity from a thread.</p>

<p>The thread is also responsible for consuming the wcf and re-providing the data.</p>

<p>So I start the new (same)activity from this separate thread and I finish the current activity from the ui-thread of the activity.</p>

<p>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.</p>

<p>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.</p>

<p>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.</p>

<p>My question is how can I synchronize these actions?</p>
