Alertdialog button does not appear

Asked

Viewed 262 times

0

I’m trying to get the button okay appear.

I want to do with AlertDialog.

That stretch is within a second Trhead. Help me?

 activity.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                mProgressDialog.dismiss();
                                builder = new AlertDialog.Builder(activity);
//                                        builder.setMessage("Teste ok?")
//                                                .setTitle("TESTE OK?");
//                                        AlertDialog dialog = builder.create();
                                    builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                                    public void onClick(DialogInterface dialog, int id) {
                                        // User clicked OK button
                                        startActivity(new   Intent(CadastroActivity.this, MenuActivity.class));
                                        finish();
                                    }
                                });
                                 dialog = builder.create();
  • ta missing you put ai dialog.show() after create();

1 answer

1


Had stayed like this:

activity.runOnUiThread(new Runnable() {
                                @Override
                                public void run() {
                                    mProgressDialog.dismiss();
                                    builder = new AlertDialog.Builder(activity);
    //                                        builder.setMessage("Teste ok?")
    //                                                .setTitle("TESTE OK?");
    //                                        AlertDialog dialog = builder.create();
                                        builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                                        public void onClick(DialogInterface dialog, int id) {
                                            // User clicked OK button
                                            startActivity(new   Intent(CadastroActivity.this, MenuActivity.class));
                                            finish();
                                        }
                                    });
                                     dialog = builder.create();
                                     dialog= builder.show();
  • huehuehuehue forgot the show();

Browser other questions tagged

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