-1

I am trying to call webmethod from Android using ksoap2 then error is that :

android.os.NetworkOnMainThreadException.

How can i user Service/InternetService in this case of android.os.NetworkOnMainThreadException with code

user1508234
  • 7
  • 1
  • 5

1 Answers1

0

In the newer versions of android it has been restricted to use network operations on main thread/activity to avoid ANR and enhance user experience and app responsiveness. It works fine till 2.3 (not precise) but raise exceptions in advanced ones.

So it is suggested to use network or other long operation apart from main thread. You an use AsyncTask or Service/IntentService for such cases.

Hope this helps...Please uprate if you find some good in it...

umair.ali
  • 2,714
  • 2
  • 20
  • 30