title: What would be the best way to make this run Async
body: <p>I have to java classes, one the activity and the other is the class i want to run a void from.
  Web.java looks like:</p>
  
  <pre><code>import org.jsoup.Jsoup;
  import org.jsoup.nodes.Document;
  
  import java.io.BufferedReader;
  import java.io.InputStreamReader;
  import java.net.HttpURLConnection;
  import java.net.URL;
  
  public class Web {
      public Document requestPage(String urll) throws Exception {
          StringBuilder result = new StringBuilder();
          URL url = new URL(urll);
          HttpURLConnection conn = (HttpURLConnection) url.openConnection();
          conn.setRequestMethod("GET");
          BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
          String line;
          while ((line = rd.readLine()) != null) {
              result.append(line);
          }
          rd.close();
          Document doc = Jsoup.parse(result.toString());
          return doc;
      }
  }
  </code></pre>
  
  <p>And my MainActivity.java looks like this:</p>
  
  <pre><code>import android.support.v7.app.AppCompatActivity;
  import android.widget.Button;
  import android.widget.EditText;
  import android.view.View;
  import android.widget.Toast;
  
  import org.jsoup.Jsoup;
  import org.jsoup.nodes.Document;
  
  
  public class MainActivity extends AppCompatActivity {
  
      Button Visit;
      EditText Urlbox;
      Web web = new Web();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
          StrictMode.setThreadPolicy(policy);
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Visit = (Button)findViewById(R.id.Button);
          Urlbox = (EditText)findViewById(R.id.EditText);
          Visit.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Document lol = web.requestPage(Urlbox.getText().toString());
                  if(lol.text().toString() != null){
                      Toast.makeText(MainActivity.this, "Visit success!",Toast.LENGTH_SHORT).show();
                  }
              }
          });
      }
  }
  </code></pre>
  
  <p>And this works fine over the main thread most, but i want to make it go over a different thread so my UI doesnt get jammed if the connection is bad
  How would i make this work in async? This is my first time i use async but i just dont understand how i should use it, ive spent a few days trying to figure it out with absolutely no success
  So if i could get some examples that do work that would be fantastic so i could compare it to my current code and learn what i did wrong</p>