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(); } } 
0

2 Answers 2

0

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

Check the documentation here: Dialogs

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.