Have been searching the web and stack overflow for this - I found a potential answer but it was not well explained enough for me as I am new to android.
I am working on an android app that displays alert dialogs at key times. I am currently having the app add the dialog to the current activity to make sure it appears.
However, sometimes the dialog can appear just as the user tapped a button to a new activity, causing the new dialog to be appearing on the previous activity and not seen unless the user hits back.
Another case is occasionally two dialogs will be appearing, and upon accepting the top-most the app brings the user to a new activity - leaving the second dialog on the previous activity and again unseen without hitting back.
The closest I could find was here: Keep dialog/activity always on the top
The above question was not fully explained in the answer. I tried following the advice by adding a new relative layout to each of my existing layouts with the ID "alert_layout" and I already had a BaseActivity all my activities extend from. When I need to show an alert I add it to the current activity's "alert_layout"'s context but it is yielding the same result. I am not sure how to add a layout that is never changed between activities - but even then, the AlertDialog is looking for a context to be added/shown to, not a layout, so I'm confused as to how to accomplish this.
I am new to Android development so I apologize if I'm missing the obvious, but I'm hoping there is an easy way to make sure AlertDialog is always on top of all activities and remains there across activity changes.
Thank you in advance for any assistance.