We're using a HandlerThread in the following manner: HandlerThread updateThreadRemote = new HandlerThread("Update Thread"); updateThreadRemote.start(); Process.setThreadPriority(updateThreadRemote.getThreadId(), Process.THREAD_PRIORITY_BACKGROUND); Handler updateHandlerRemote = new Handler (updateThreadRemote.getLooper());
But on occasion we'd get an exception on the setThreadPriority() line saying that the thread ID didn't exist, meaning the thread hadn't actually started yet. We then looked at the source for the getLooper() method of the HandlerThread it seems like it could return null if the thread's isAlive() is false. So my question is: Is there a chance that isAlive() could be false even though I've called start()? i.e. The OS has not actually started the thread yet or something like that, in which case the Handler would be scheduled on the calling thread, not the HandlerThread I just created? Is there a correct way to start and use these HandlerThreads other than what I'm doing here? Thanks for any advice or help, Matt -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en