I created the AlertDialog using the builder. It shows when we call the show() method. I have the cancel button in that dialog. I can cance
AlertDialog
show()
remove the previous dialog before adding new one. If you continue adding new dialog each time this will stay in your memory and your app will consume more battery.
call remove view or removeAllViews() on layout in which you are adding your dialog.