Вы можете использовать isShowing()
метод
AlertDialog yourAlertDialog = new AlertDialog.Builder(getContext()).create();
if(!yourAlertDialog.isShowing()){
//Here you can show your dialog else not
yourAlertDialog.show()
}
IN KOTLIN
val alertDialog= activity?.let { AlertDialog.Builder(it).create() };
if(!alertDialog?.isShowing!!){
//Here you can show your dialog else not
alertDialog.show()
}
В случае, если у вас есть два или более диалоговых окна,
val alertDialog1= activity?.let { AlertDialog.Builder(it).create() };
val alertDialog2= activity?.let { AlertDialog.Builder(it).create() };
val alertDialog3= activity?.let { AlertDialog.Builder(it).create() };
if(alertDialog1?.isShowing!! && alertDialog1?.isShowing!!){
//Some dialog is shown
}else{
//Here you can show your dialog else not
alertDialog3.show()
}