[android-developers] Re: Appwidget + AsyncTask + Handler

2011-04-20 Thread b_t
It works well if it is the main thread. In all my version I uses this way. There isn't long-running work when I update my widget but sometime (very very rarely) I got ANR. For example when I try to get application label from PackageManager. I thought that I can avoid these ANRs with AsyncTask but

Re: [android-developers] Re: Appwidget + AsyncTask + Handler

2011-04-20 Thread Dianne Hackborn
Do your work on the main thread, at least the stuff retrieving the bluetooth adapter. Is there a reason you are using AsyncTask for this anyway? Is there some long-running work you are also doing? 2011/4/20 b_t > I don't know what firmware it is but when I updated my app today I got > tons of

[android-developers] Re: Appwidget + AsyncTask + Handler

2011-04-20 Thread b_t
I don't know what firmware it is but when I updated my app today I got tons of error mails from different types of devices so it must be a popular one. On Apr 20, 4:17 pm, Kostya Vasilyev wrote: > Have you looked at Android's own Power Controls widget? It's part of > Settings application. > > Als

Re: [android-developers] Re: Appwidget + AsyncTask + Handler

2011-04-20 Thread Kostya Vasilyev
Have you looked at Android's own Power Controls widget? It's part of Settings application. Also, is it possible you're dealing with some heavily modified, buggy firmware? 20.04.2011 18:00 пользователь "b_t" написал: > The original stack trace is: > > Caused by: java.lang.RuntimeException: Can't

[android-developers] Re: Appwidget + AsyncTask + Handler

2011-04-20 Thread b_t
The original stack trace is: Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() at android.os.Handler.(Handler.java:121) at android.bluetooth.BluetoothAdapter $1.(BluetoothAdapter.java:961) at android.bluetooth.Blueto