I am aware that, since AlertDialog is part of a presenting Activity, showing it doesn't trigger OnPause of the Activity. What I want to achieve is to show AlertDialog and somehow trigger OnPause of the presenting Activity.
In the OnResume I set OnGlobalLayoutListener to adjust the position of the scrollview based on whether the keyboard is visible. However, if an AlertDialog is visible then it probably doesn't make sense to keep listening to the layout changes and adjusting the scrollview accordingly, considering the "focus" is currently on the AlertDialog and the Activity is partially visible in background.
I am aware that I can start activity with "popup" style but this is not what I want; I want to use AlertDialog.