I am creating an app to send mail.But i want to finish(not waiting to send mail ) my activity on the send button click and make the mail sending activity in background(Make the mail sending Async).Any one with new idea PLEASE SHARE.......
Asked
Active
Viewed 350 times
0
-
you want to send mail in background?? – KMI Sep 28 '12 at 04:34
-
refer this one http://stackoverflow.com/a/2033124/1021695 – KMI Sep 28 '12 at 04:36
1 Answers
1
Please Try this if u want to use Async Task.I use many of time in my app for background work.
private class EmailSending extends AsyncTask<Object, Integer, Object> {
@Override
protected void onPreExecute() {
ProgressDialog progress = ProgressDialog.show(Activity.this, "",
"Loading...");
super.onPreExecute();
}
@Override
protected Object doInBackground(Object... params) {
//do hard work here
return params;
}
@Override
protected void onProgressUpdate(Integer... values) {
progress.getProgress();
}
@Override
protected void onPostExecute(Object result) {
progressBar.dismiss();
super.onPostExecute(result);
}
}

Naveen Kumar
- 3,738
- 4
- 29
- 50
-
thank u very much .. but i have get the solution in another way.I think this will also work – user1702516 Sep 28 '12 at 07:12