Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top