Frage

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?

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top