Jason LeBlanc wrote:
> I have tried moving the start Service call to a manually-managed thread
> within the Activity, but with the same results. The UI Thread still
> hangs when the Service attempts to connect to an invalid server.

:: shrug ::

If you think this is a bug in Android, create a sample project that
demonstrates it and post it on http://b.android.com.

Otherwise, you're doing something wrong.

> In the Service, I instanciate a Connection object from which the
> class extends a Thread.

Are you saying that Connection extends Thread?

> It's in the constructor of that the Connection
> class where I create a new Socket.

A Thread object is not on a separate OS thread until the Thread is
called with start(). Notably, the Thread constructor is called on the
thread of whoever invokes the constructor. Background work occurs on the
Thread's run() method.

You want to do the IP connection in the background. Hence, do not do it
in a Thread constructor.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Online Training: 10-14 May 2010: http://onlc.com

-- 
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to