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. Considered SOLDFw: Wts droid 2 mind condition

aih saya dibilang ramah.. moga2 bukan ramah (rajin menjamah) #apasih
#becanda :p

buat temen ane nih... maniak winmo, tp gak mau ganti ke winmo 7. Milihnya
akhrnya malah ke d2. Makasih jg pak joni buat keramahannya dalam pelayanan
jual beli.

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

2. Waiting for debugger force close (when USB is not attached)

Hi All,

My app is in debuggable mode. On some occasions it crashes with the
message:
"Waiting for de{*filter*} to attach..."

This happens when my Tmobile G2 is not attached to computer.
When I plug inthe USB the message goes away.

Does anyone come across this problem with their app?

Regards,

AK

-- 

3. Waiting for Debugger

4. High sensor usage in stand by

5. PAGING BOS ARYA

6. Partisi Micro SD

7. Worms Mobile Untuk Android Rilis