View ProgressDialog Spinner?

1

Well I need to do a long task so I did a ProgressDialog to report such a task, however the spinner that should be appearing seems hidden or something.

  protected void onPreExecute (){
        progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
        progress = ProgressDialog.show(Login.this, "Aguarde...",
                "Logando...");
        super.onPreExecute();
    }

I've already put the code in onCreate () but it still does not work, any ideas whatsoever?

    
asked by anonymous 28.07.2016 / 14:31

1 answer

1

Try the following way:

    @Override
    protected void onPreExecute() {
        progress = new ProgressDialog(Login.this);
        progress.setTitle("Aguarde");
        progress.setMessage("Logando...");
        progress.show();
    }

In onCreate , call your Task as follows:

 MinhaTarefa tarefa = new  MinhaTarefa();
 tarefa.execute((Void)null);

This is just an example, adapt if your AsyncTask use parameters to execute!

    
28.07.2016 / 14:38