Error while adding Progressidialog

Asked

Viewed 69 times

3

inserir a descrição da imagem aquiI’m having trouble adding a dialog in this listview method, there is another way to make it work?

listDebitosPendentes.setOnItemClickListener(new AdapterView.OnItemClickListener() {

    dialog = ProgressDialog.show(DetalhesDebitosActivity.this,
                             "Aguarde","Enviando Boleto....",true);
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {              
        Intent intent= new Intent(getApplicationContext(),DetalhesDebitosActivity.class);
        //Passa para a activity o id no banco de dados
        intent.putExtra("ID",id);
        startActivity(intent);

    }
});
  • Which error occurs?

  • @Marcogiovanni, I added an error print to the question

  • Try it this way android.app.ProgressDialog.show(...)

  • @Marcogiovanni, continues the same error.

  • Dei +1 despite the song

1 answer

2


Try this code to show an indeterminate progress bar that shows a spinner:

dialog = new ProgressDialog(DebitosPendentesActivity.this);

dialog.setIndeterminate(true);
dialog.setMessage("Enviando Boleto....");
dialog.setTitle("Aguarde");
dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
dialog.show();
  • Oops, it worked! Thanks.

  • I only have a problem, when I return from the Internet where I show the details of this boleto, the dialog does not end, only if I click off the screen. Is there any way you can put the dialog.dimiss();

  • @Rodrigo.oliveira, according to its logic, the dialog.dismiss(); shall be called when the boleto is finalised. However, in your code, you are only showing the dialog when the user registers a Reader for the list, so you start the dialog, but you have no control over when to finish it. It would be interesting for you to read Async Tasks

Browser other questions tagged

You are not signed in. Login or sign up in order to post.