0

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.......

1 Answers1

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