如何在 Android 3.0 上使用 ksoap2+蜂窝
因此,我创建了一个简单的 hello world 程序,该程序在 Android 2.3 上使用 ksoap2,并且运行得非常好。但是,当我在 Android 3.0 Honeycomb 上使用完全相同的代码(实际上我使用的是 Android 3.1)时,它不起作用。该应用程序没有崩溃或发生任何事情,但 ksoap2 操作似乎未完成或没有响应。尽管我已经添加了:
对于我的 AndroidManifest.xml 文件,ksoap2 似乎没有响应。我想知道由于我使用的是 Android 3.0+ sdk,是否需要进行任何其他更改?谢谢。
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 seems 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您很可能在主 UI 线程上运行 Web 服务请求,这在 3.0 及以上版本中不再允许。将其移至 AsyncTask 中。
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.
如果您正在开发的应用程序在 Honeycomb (3.0) 上运行,则必须使用另一个线程来调用 Web 服务,因为 UI 线程不支持此操作,否则将抛出一个名为 NetworkOnMainThreadException。欲了解更多信息:响应式设计
这里有一个关于在没有 ksoap2 的蜂窝
http://aaarkonusurum.blogspot.com/2011/10 /3-party-kutuphane-kullanmadan-ksoap2.html
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