I am currently able of sending stuff into a server with ksoap2 library for android. Now I have the need to make sure that this line doesn't block the app and makes it ANR:

androidHttpTransport.call(connection.getSOAP_ACTION(), envelope);

If by any reason i cant reach the server (for example the server is shutdown) this call blocks the app. how can i treat this?

有帮助吗?

解决方案

You should run calls like this within an AsyncTask, so it doesn't block the UI Thread.

Also, you might be interested in this blog article on Painless threading in Android.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top