Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top