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. OHA members are inside Android - literally ...njoy

View

http://namoham.blogspot.com/2008/04/blog-post.html
--~--~---------~--~----~------------~-------~--~----~

2. Date and time pickers in an XML layout file - how to get to work?

I've tried including date and time pickers in the XML file, like the
following:

<DatePicker
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />

<TimePicker
        android:id="@+id/wtb_event_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        />

But I get:

ERROR/AndroidRuntime(2930): Caused by: java.lang.RuntimeException:
Binary XML file line #40: You must supply a layout_width attribute.
ERROR/AndroidRuntime(2930):     at android.content.Resources
$StyledAttributes.getLayoutDimension(Resources.java:1247)
ERROR/AndroidRuntime(2930):     at android.view.ViewGroup
$LayoutParams.setBaseAttributes(ViewGroup.java:2641)
ERROR/AndroidRuntime(2930):     at android.view.ViewGroup
$LayoutParams.<init>(ViewGroup.java:2605)
ERROR/AndroidRuntime(2930):     at
android.view.ViewGroup.generateLayoutParams(ViewGroup.java:2101)
ERROR/AndroidRuntime(2930):     at
android.view.ViewInflate.inflate(ViewInflate.java:358)
ERROR/AndroidRuntime(2930):     at
android.view.ViewInflate.inflate(ViewInflate.java:292)
ERROR/AndroidRuntime(2930):     at
android.view.ViewInflate.inflate(ViewInflate.java:241)

There is a layout_width attribute, so what's wrong? I've tried putting
only one of those views inside of a layout file, and even if the
Eclipse Android project doesn't complain, the emulator does.
--~--~---------~--~----~------------~-------~--~----~

3. GTALK CONNECTION PROBLEM

4. Single .apk from Multiple projects

5. SSL client side authentication

6. Unable to access web via emulator

7. How to debug Android in Eclispe by win2000?