-2

Thank you for your help :)

I've resolve my problem

PotatoesPower
  • 94
  • 1
  • 9
  • Look at this [SO Answer](http://stackoverflow.com/a/6343299/1889768) this explains what you are facing and how to overcome the issue. – Abbas Sep 02 '16 at 10:09
  • Add below line in onCreate method `StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);` else create a AsynTask or Thread – Raghavendra Sep 02 '16 at 10:21

1 Answers1

1

Your Problem is that your are running Network on Main Thread. As UI is rendered on Main Thread android does not allow to run network related operation on main Thread. Use AsyncTask for running your network operations. You will get lot of examples of how to use asyncTask on stackoverflow iteself.

Nikhil
  • 3,661
  • 8
  • 31
  • 43