Thanks Dianne, for the reply. I fixed it by shifting the handler to the background thread, and including the looper quit() inside the handler.
On Oct 10, 2:34 am, Dianne Hackborn <hack...@android.com> wrote: > That is simply not how Looper works. You call Looper.loop() to have the > thread enter the message looper, and process messages until it is time for > the thread to exit. > Specific comments: > > The following code illustrates my problem: (pls note the lines > > > referred: 1,2,3,4&5) > > Question 1: After calling looper.loop in line3, line4 and 5 don't run. > > Why is this? I tried quit(), but it doesn't help. > > Where did you try quit()? A looper continues running its loop until you > tell the looper to quit. > > Also note that in the code you have included, your 'handler' is associated > with the main thread (since it was constructed from the main thread), not > the other thread you are creating. You haven't made any handlers to the > secondary thread, so have never sent a message to it, so it has just sat in > the loop and done nothing. > > Question 2: Instead of displaying 0,1,2,3,4 in one blocking call (at > > > line3), I'd like to have 5 different blocking calls for each. > > You can't. > > > Essentially (sorry, if i sound repetitive), I want to be able to use > > looper in such a way that each time, it ensures only one message gets > > handled. Is there a way to do this? > > No. > > -- > Dianne Hackborn > Android framework engineer > hack...@android.com > > Note: please don't send private questions to me, as I don't have time to > provide private support, and so won't reply to such e-mails. All such > questions should be posted on public forums, where I and others can see and > answer them. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---