I have RealViewSwitcher control and I am using some code to update my UI in OnScreenSwitchListener like the following
public void onScreenSwitched(int screen) {
//1 update some text view for example
//2 heavy process
}
the updates of my UI doesn’t appear until heavy process completes , How can I update my text views instantaneously ?
You can’t, per se.
However, most likely, your “heavy process” should be done a background thread, such as an
AsyncTask. This will have the effect of having your UI updates be processed more quickly.If your “heavy process” itself is UI updates, you will need to arrange to delay the “heavy process” until sometime after your current method has returned and Android can work on your first set of UI updates. One approach to doing this is to put the “heavy process” work in a
Runnablethat you schedule for execution using thepost()method available onHandleror anyView.