I know that ProgressDialog with Threads questions have been asked many times but none of the solutions seem to work for my project. Basically what I want to do is this: 1) when
You better use AsyncTask (which is the Android way):
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new TheTask().execute();
}
private class TheTask extends AsyncTask{
@Override
protected void onPreExecute() {
authProgressDialog = ProgressDialog.show(XXX.this, "", "Authenticating...", true, false);
}
@Override
protected Void doInBackground(Void... params) {
authenticate(); // method that calls the API via SOAP
authenticateReal(); // method that handles the response
return null;
}
@Override
protected void onPostExecute(Void result) {
authProgressDialog.dismiss();
}
}
By the way... I have found this presentation to be very useful (it talks about REST apps, but you can apply the same concept for different kind of apps): Developing Android REST client applications