application freezing with Looper

by Pedro Cristov茫o » Tue, 20 May 2008 02:55:28 GMT


Sponsored Links
 hi all.

my android application freezes when using the Looper.prepare() ->
Looper.loop() -> Looper.myLooper().quit() sequence. here's the code
where it blocks:

public void endData() {
               String result = new String(baf.toByteArray());

               Looper.prepare();
               Toast.makeText(myActivity, result,
Toast.LENGTH_SHORT).show();
               Looper.loop();

               Looper.myLooper().quit();

}

any idea of what the problem might be?

thanks in advance,

pedro cristovo.
--~--~---------~--~----~------------~-------~--~----~



application freezing with Looper

by Romain Guy » Tue, 20 May 2008 02:58:43 GMT


 Looper.loop() creates a loop in which your application gets stuck. Why
are you using a Looper here?






-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


application freezing with Looper

by Pedro Cristov茫o » Tue, 20 May 2008 03:44:46 GMT


 thanks for your reply, romain guy.

if i don't use the Looper i get this error: "Can't create handler
inside thread that has not called Looper.prepare()."




--~--~---------~--~----~------------~-------~--~----~



application freezing with Looper

by Romain Guy » Tue, 20 May 2008 03:50:29 GMT


 The call to Toast.makeText() should happen on the UI thread, not on a
background thread like you are doing right now. You can use
View.post() or create a new instance of Handler and call post() on it
to executed your code on the UI thread.








-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~



application freezing with Looper

by Pedro Cristov茫o » Tue, 20 May 2008 03:50:31 GMT


 thanks for your reply, romain guy.

if i don't use the Looper i get this error: "Can't create handler
inside thread that has not called Looper.prepare()."




--~--~---------~--~----~------------~-------~--~----~



application freezing with Looper

by Pedro Cristov茫o » Tue, 20 May 2008 03:53:46 GMT


 thanks for your reply, romain guy.

if i don't use the Looper i get this error: "Can't create handler
inside thread that has not called Looper.prepare()."




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Tablet Platform

(froyo) CyanogenMod Rom 7.3.1 rooted

-- 
===============
"

2. CHECK OUT

bagaimana yach cara mendaftar google check out, mohon pencerahan atas
langkah2 awalnya... :-)

thx anyway

-- 
===============
"

3. Update. WTS : Android (Harga Gila).

4. Determining the subset of text showing in a TextView?

5. My Phone Number

6. Is it possible to change java byte code that is already generated?

7. Ask : setting email