I have an ProgressDialog where in shows while sending mail. The progress dialog works across activities and classes as one of the blog had given an hint showing ProgressDialog across activities.
Below is the code as I am overriding onCreateDialog()
@Override
protected Dialog onCreateDialog(int id) {
if(id == ID_SENDING_MAIL){
ProgressDialog loadingDialog = new ProgressDialog(this);
loadingDialog.setMessage("Sending Email...");
loadingDialog.setIndeterminate(true);
loadingDialog.setCancelable(true);
return loadingDialog;
}
return super.onCreateDialog(id);
}
then I call the mail sending as below
showDialog(ID_SENDING_MAIL);
new Thread(new Runnable(){
public void run(){//I am calling Mail Send here
dismissDialog(Email.ID_SENDING_MAIL);
}
}).start();
In run method I instantiate mail class and send host of parameters.
This is working fully but I want to set different messages to ProgressDialog.
Like at the time of connecting to Host
Sending Mail then
Mail Sent Successfully
How could we carry out those changes when used with onCreateDialog().
Looking forward to your reply.
thanks.
best way to do this by using
AsyncTask:and in
onProgressUpdate(Integer... progress)use progress param to set desired messages toProgressDialog(using swith of any other method to determine wat the exact message should be)