I have bottomsheet that check if the internet connected or not! if no connected the bottomsheet showed, if not the bottomsheet dismiss. I used bottomSheetDialog.dismiss(); function to prevent the user from pressing the screen to hide the bottomsheet. Now what I want is that the user if press back when bottomsheet showed exit the app. not exit bottocheet first and