title: Android get data from internet (android.os.NetworkOnMainThreadException)
body: <p>Ok, I have read a lot of questions here on StackOverflow but i still can't understand so i'm opening a new question.</p>
  
  <p>I made a class which function connects to internet and fetches json as string. It works fine in normal Java Application but i can't get it work in my android project. </p>
  
  <p>I'm getting next error: android.os.NetworkOnMainThreadException</p>
  
  <p>So to my understanding I have to use AsyncTask but I don't know how to wrap my function into it.</p>
  
  <p>Function looks like this:</p>
  
  <pre><code>public static String get(String url){
    //connect and get data to string
    // return string
  }
  </code></pre>
  
  <p>Like I said it works fine in normal JavaApplication but not in android project.</p>
  
  <p>Thx for help!</p>