I have taken a custom dialog with edittext on it to enter OTP. I have check whether OTP entered is correct or not. I also want to show toast message if no OTP is entered in edittext but the dialog opened should remain opened. Below is my code
alertDialogBuilder
.setCancelable(false)
.setPositiveButton("Ok",
new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int id){
enterOtp=edtEnterOtp.getText().toString().trim();
if(enterOtp.equals(randomNumber+"")){
sendWalletBallance();
}else{
Toast.makeText(MerchantPayment.this,"OTP Mismatch",Toast.LENGTH_LONG).show();
}
}
})
.setNegativeButton("Cancel",
new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog,int id){
dialog.cancel();
}
});
AlertDialog alertDialog=alertDialogBuilder.create();
alertDialog.show();
You wanted to show A Toast then it ll help!!!