2 messages in com.googlegroups.android-beginners[android-beginners] Re: android freez...| From | Sent On | Attachments |
|---|---|---|
| Pedro Cristovão | 19 May 2008 03:41 | |
| Justin (Google Employee) | 21 May 2008 13:59 |
| Subject: | [android-beginners] Re: android freezing with Looper![]() |
|---|---|
| From: | Justin (Google Employee) (j....@google.com) |
| Date: | 05/21/2008 01:59:04 PM |
| List: | com.googlegroups.android-beginners |
Pedro,
What are you trying to accomplish exactly here? If you are just trying to show a message to the user for a certain period of time, all you need is Toast.makeText().
If you are using a looper you need to create add a Handler member to your class that will receive and process messages from the message loop. Presumably the Handler then contains some logic to call Looper.myLooper().quit(). When Looper.loop() is called your thread will go into the message handling loop until some code that executes in that loop (from your Handler) tells the loop to stop.
I've posted a sample of using the Looper class in a file called dorothy.zip
Cheers, Justin
On May 19, 3:42 am, Pedro Cristovão <pcri...@gmail.com> 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 sugestion of what the problem might be?
thanks in advance,
pedro cristovão.
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to andr...@googlegroups.com To unsubscribe from this group, send email to andr...@googlegroups.com 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-beginners?hl=en -~----------~----~----~----~------~----~------~--~---




