AlertDialog button does not appear

0

I'm trying to get the ok button to appear.

I want to do with AlertDialog .

This snippet 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();
    
asked by anonymous 09.12.2016 / 20:21

1 answer

1

It will look 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();
    
09.12.2016 / 20:31