display dialog of another activity in android


From activity 1, I open activity 2. Now when I am in the screen of activivty 2, I receive an event of activity 1 and onrecieve of that event i want to display a dialog. How can I do that??
While I am in activity 2 I dont see the dialog, but when I get back to activity 1, i see the dialog.

I want to see the dialog even when i am in screen of activity 2.
I looked into this link as well, but wasnt much helpful
Showing dialog on top of another running activity (Android)?
on receiving the reqd event, i call this method.


First create separate dialog in Activity 2 and do below mentioned

  1. Try to send broadcast when data related to activity 1 is received.
  2. Create a Receiver class which will listen the broadcast
  3. Now you have to use of Observer Design pattern i.e. when ever there is some event in Receiver class it will inform Activity B that data is arrived and show the appropriate dialog.

Please share the result if it not succeeded.

Answered By – Roll no1

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published