I have the following class, which calls a web service that sends an email, which can take up to 5 seconds, depending on the connection.
The idea is to show a message to the user while the mail is being sent, so that it is on hold and can not perform any action

This is my class:

```
private class TareaEnviarMail extends AsyncTask<String, Void, String>
    {
        ProgressDialog.Builder b;

        @Override
        protected String doInBackground(String... params)
        {
            try {

                URL url = new URL("https://example.sendmail.com");
                HttpURLConnection conn = (HttpURLConnection) url.openConnection();
                conn.setRequestMethod("POST");

                InputStream in = new java.io.BufferedInputStream(conn.getInputStream());
                String response = org.apache.commons.io.IOUtils.toString(in, "UTF-8");

            }
            catch(Exception ex)
            {
                Log.e("Error",ex.toString());
            }

            return null;

        }

        @Override
        protected void onPostExecute(String result)
        {
            //HERE, I WANT TO DISMISS THE DIALOG!!! LIKE b.dismiss(); ¿?
            Intent intent = new Intent(getApplicationContext(), ActividadPrincipal.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
        }

        @Override
        protected void onPreExecute()
        {
            b = new  ProgressDialog.Builder(ActividadNuevoTurnoSeleccionar.this);
            b.setTitle("Enviando correo. Revise su casilla.");
            b.setMessage("Por favor, espere mientras registramos el turno y le enviamos la confirmación a su casilla.");
            b.create().show();
            //ProgressDialog.show(ActividadNuevoTurnoSeleccionar.this,"Enviando correo. Revise su casilla.", "Por favor, espere mientras registramos el turno y le enviamos la confirmación a su casilla.");
        }

        @Override
        protected void onProgressUpdate(Void... values) {}
    }

```

The problem is that now I don't know how to close the dialog in onpostexecute method, when the background task is over. Since I don't have the dialog, but the builder.
Could you help me? Thank you