I'm currently using a long running service as a timer that can last up to 4 hours. The activity that calls the service usually gets destory when its in the background for awhile. When the service is finished its task, it calls the activity back to the foreground. The service then sends a boardcast to the activity that it has finish and the activity then plays an alarm.
The issue is the activity uses an alert dialog to display the opition to stop the alarm but since the activity was perviously "dead" it needs to go through the onCreate phase. I get an error because the alert dialog which is tiggered from the broadcast reciever is trying to display before the layout has actually finished creating and displaying its self. I get a force close and the window manager error.
How can I my alert dialog wait until the layout is displayed and the onCreate method is finished?