John,
It's not a good idea to do networking on the UI thread. As you found
out, if there is a delay, for reasons that you can't control, the user
gets the ANR dialog ("application not responding").
Take a look at several options offered by Android to move your
networking code to a worker thread:
- AsyncTask
- IntentService
- An improvement upon IntentService, developed by Mark Murphy:
WakefulIntentService
-- Kostya
17.09.2010 23:59, john brown пишет:
It does however display the error "Application MyApp (in process
mnt.android.myapp.MA103) is not responding." along with a Force Close
button and a Wait button. If I wait a moment and press the Wait
button, the app proceeds like it should.
What can I do to avoid the long wait (and error) when there is no
service?
--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en