How to add tabbar in doinbackground asynctask in android? or how to run splash screen in thread? I want to show a progress dialog or splash screen until tab bar is loaded from calling tabbar class I am calling webservices and parsing the value takes time, for few mins mean time, I have to show progessbar or splash screen. Can anybody tell me how to implement this? Can anybody give sample code?
I tried but its not working
dlg = ProgressDialog.show(this, "Working..", "Downloading Data...", true, false);
Thread splashThread = new Thread() {
@Override
public void run() {
try {
sleep(100000);
} catch (InterruptedException e) {
// do nothing
} finally {
}
}
};
splashThread.start();
you cannot touch anything of the main ui thread from a background thread, in order to do that you have to use a handler who manages the synchronization between background thread and ui main thread.
the better way is subclassing the AsyncTask, doing this, you already have methods who works on background and methods who work on the ui. With this, you can perform the background operation and inmediatly shows the result…
http://developer.android.com/reference/android/os/AsyncTask.html
read more here
hope this helps…