Hi All, I am having an Android Service with a worker thread.
>From the worker thread I want to do: 1. Toast.show 2. Get the user agent - String userAgent = new WebView(TestAlarmService.this).getSettings().getUserAgentString(); My problem is if I don't use Looper.prepare I got an exception which make sense java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() I tried a couple of solutions: A. If I add to my worker thread only one code line Looper.prepare(); (without looper.loop loop.quit), I do get the user agent, b but I don't see the toast, although there are two CONSECUTIVE log messages (with a real duration and zero one, but I don't think this is my problem) INFO/NotificationService(52): enqueueToast pkg=com.plankton.test.alarm callback=android.app.ITransientNotification$Stub$Proxy@44cb0eb0 duration=1 INFO/NotificationService(52): enqueueToast pkg=com.plankton.test.alarm callback=android.app.ITransientNotification$Stub$Proxy@44ca8ea8 duration=0 Can i do a looper.prepare without looper.loop ? B. If I don't use Looper.prepare, but handler.postDelayed() everything works fine. I want to know if it is possible to achieve what I want without using a Handler ? And if it is not possible, how can I get the User Agent in a synchronize way? Thanks. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

