Your thread will never exit -- it will remain in Looper.loop(), because you
never told it to quit out of the loop.

On Tue, Sep 28, 2010 at 3:43 AM, Kakyoin <[email protected]> wrote:

> Hi.
>
> Allow me to make another thread exclusively for this. I'm sure other
> dev would want to know as well.
>
> According to the doc here:
> http://developer.android.com/reference/android/os/Looper.html#loop()
>
> --------------------------------------------------------------------------
> public static final void loop ()
>
> Since: API Level 1
> Run the message queue in this thread. Be sure to call quit() to end
> the loop.
> --------------------------------------------------------------------------
>
>
>
>
> Question:
> If I use Looper.prepare() and then Looper.loop() like this:
> --------------------------------------------------------------------------
> new Thread(){
>
>                        @Override
>                        public void run() {
>                                Looper.prepare();
>
>                                // my code here (create handler and stuff)
>
>                                Looper.loop();
>                        }
>
>                }.start();
> --------------------------------------------------------------------------
>
> What will happen if I don't call quit()? Actually I have no idea
> 'when' and 'where' should I call quit().
>
> Will this "loop" disappear by itself after my application exit?
>
> Thank you in advance!
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

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 [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

Reply via email to