The interface disappears, but the warning dialog is not displayed

I have an Activity that will display Alert Dialog in seconds. Before displaying the dialog box, immediately click the Home button. Again, if I go back to my application, the interface will disappear, but the warning dialog is not displayed (apparently). If I click the Back button and cancel the popup, my Activity will be active again. The question is, why does the dialog appear but not appear? How can I avoid this situation?

+6
source share
1 answer
  While creating your alert try Dialog alertDialog = new Dialog(currentActivity); alertDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH); alertDialog.setCanceledOnTouchOutside(true); alertDialog.setCancelable(true); WindowManager.LayoutParams WMLP = alertDialog.getWindow().getAttributes(); WMLP.x = 0; WMLP.y = 0; WMLP.dimAmount = 0.0f; alertDialog .getWindow().setAttributes(WMLP); 
0
source

Source: https://habr.com/ru/post/895644/


All Articles