[Solved] android.os.NetworkOnMainThreadException [duplicate]


Always use AsyncTask to solve this issue.

BUT, if you’re within the movie Swordfish, someone points a gun at you and say “fix it in 30 seconds”, then change your targetSdkVersion to 9 in the Android Manifest and the exception will stop. Don’t worry, it will run on devices with version higher than 9 too. Even so, correct your code later using AsyncTask.

9

solved android.os.NetworkOnMainThreadException [duplicate]