How to use ksoap2 on Android 3.0+ Honeycomb
So I created a simple hello world program that uses ksoap2 on Android 2.3 and it works perfectly fine. However, when I use the exact same code on Android 3.0 Honeycomb (actually I'm using Android 3.1), it does not work. The app doesn't crash or anything, but it seems as if the ksoap2 operations is not completed or doesn't respond. Even though I have added:
to my AndroidManifest.xml file, it seem开发者_如何学Pythons like ksoap2 is not responding. I was wondering if I have to make any additional changes since I'm using the Android 3.0+ sdk? Thanks.
Most likely you are running the webservice request on the main UI thread, which is not allowed anymore in 3.0 upwards. Move it into an AsyncTask.
You must use another thread to call a webservice if the application which you are developing runs on the honeycomb (3.0) because UI thread does not support for this action otherwise it will be throwed out an exception called NetworkOnMainThreadException. for further information: Designing For Responsiveness
here is a tutorial about using soap on honeycomb without ksoap2 http://aaarkonusurum.blogspot.com/2011/10/3-party-kutuphane-kullanmadan-ksoap2.html
精彩评论