The problem is that you should never "wait" or "block" in the main thread. Your background thread needs to somehow notify the main thread that the connection is ready, and until then the main thread should be "spinning" (in the figurative sense) in its event loop, not sitting on a "wait".
On Oct 28, 1:08 pm, Hank <[email protected]> wrote: > Within my service I created a new thread that will try to establish a > internet connection, and I want it to wait for the connection to be > established before doing anything. But when I call wait() or use > ConditionalVariable.block(), it blocks the whole application and > causes ANR. Does anybody know why it does that even though I created a > child thread for this task? and do you have any solutions for this > problem? -- 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

