I am using Custom Dialog (notifier) and a button to trigger the notifier, which is located in the custom dialog arrangement itself.
When I call screenshot.take screenshot, for fraction of seconds, custom dialog disappears and screenshot event provides me something else (earlier arrangement, from where I have activated the custom dialog) than the current screen i.e. custom dialog.