0

this is my code in which the app is running just fine but the dialog box is not opening the button is clickable but no action is being performed

@Override
        public void onClick(View view){
            AlertDialog.Builder mBuilder = new AlertDialog.Builder(appointmentpage.this);
            View mView = getLayoutInflater().inflate(R.layout.dialog_otp,null);
            final EditText mOTP = (EditText) mView.findViewById(R.id.enterOTP);
            final Button mVerify = (Button) mView.findViewById(R.id.verify);

            mVerify.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    if(mOTP.getText().toString().isEmpty())
                    {
                        mVerify.setOnClickListener(new View.OnClickListener(){

                            @Override
                            public void onClick(View view) {
                            AlertDialog.Builder mBuilder1 = new AlertDialog.Builder(appointmentpage.this);
                                View mView1 = getLayoutInflater().inflate(R.layout.confirmation_final,null);



                            }
                        });
                    }
                    else{
                        Toast.makeText(appointmentpage.this,
                                "Enter OTP",
                                Toast.LENGTH_SHORT).show();
                    }
                }    

2 Answers2

0

The AlertDialog.Builder in the second OnclickListener is missing a call to the .create() method...

Check the documentation here: Dialogs

miguel_rossi
  • 53
  • 2
  • 7
0

You are missing show() or create() method invoking on your dialog builders.

Karol Kulbaka
  • 1,136
  • 11
  • 21