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.

On Mon, May 19, 2008 at 8:44 PM, Pedro Cristovão <[EMAIL PROTECTED]> wrote:
>
> 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()."
>
> On May 20, 3:56 am, "Romain Guy" <[EMAIL PROTECTED]> wrote:
>> Looper.loop() creates a loop in which your application gets stuck. Why
>> are you using a Looper here?
>>
>>
>>
>> On Mon, May 19, 2008 at 7:55 PM, Pedro Cristovão <[EMAIL PROTECTED]> wrote:
>>
>> > 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 cristovão.
>>
>> --
>> Romain Guywww.curious-creature.org
> >
>



-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to