IntentService and Toasts

One of the biggest pains in developing the latest FW and FWL releases was getting toasts to display properly. I could get them on the screen fine, but when started from my notification service they would never go away. In previous releases I punted and did some dirty hacks to get around the problem, but after much trolling of newsgroups and piecing together random bits of info I finally figured it out. Do NOT send a toast from an intent service. An intent service will launch it’s own thread, do it’s work and it and its thread go away. Apparently, if android can’t find the component (or thread, I haven’t figured that one out) that displayed your toast, it doesn’t know how to hide it. Hence it stays on the screen until you reboot.

This entry was posted in Android Development. Bookmark the permalink.

Leave a Reply