In my app there is a polling task which calls a web service periodically. According to the response of this webservice I need to display an alert dialog with two buttons.
But I’m not able to display the dialog as an alert dialog can be showned only from an activity. Only toasts are able to display. Is there any methods to display the alerts?
Showing Alerts from a background process is not a desired functionality.
I would suggest you to display a Notification in the Notification bar.
You can start an Activity from your Background Task with
In this activity you can start a regular dialog.