Neilz wrote: > Hi all, I would value your thoughts on this problem. > > I have an app which makes an HTTP request, and receives the response > as a String. I then do some stuff with this data and present it to the > user. It's all great on the emulator. > > But on the device, the response is sometimes too slow, and the > application comes up with the Dialog "Application not responding.. > Force Close or Wait". For the purposes of this app, I don't care if it > takes a while, I just want the process to complete without this > message appearing. > > So, what are my best options? Should I run the HTTP request has a > Service? Or as a different thread? A separate Activity seems the wrong > choice, as there's nothing to display, it's just a background routine. > > Comments appreciated.
Use AsyncTask. Do the HTTP request in doInBackground(). Update your activity UI in onPostExecute(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.1 Available! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

