title: Trying to launch a url using asynctask - android
body: <p>I am trying to launch a url in android using asynctask, the code shows no error but when I launch the application instead of the url displaying, it displays "hello world" to the screen. Below is my attempt:</p>
  
  <pre><code>//Starting the task. Pass an url as the parameter.
          new PostTask().execute("http://www.google.com");
  
          setContentView(R.layout.activity_main);
      }
      // The definition of our task class
      private class PostTask extends AsyncTask&lt;String, Integer, String&gt; {
      @Override
      protected void onPreExecute() {
         super.onPreExecute();
  
      }
  
      @Override
      protected String doInBackground(String... params) {
         String url=params[0];
         for (int i = 0; i &lt;= 100; i += 5) {
           try {
             Thread.sleep(50);
           } catch (InterruptedException e) {
             e.printStackTrace();
           }
            publishProgress(i);
         }
         return "All Done!";
      }
  
      @Override
      protected void onProgressUpdate(Integer... values) {
         super.onProgressUpdate(values);
  
      }
  
      @Override
      protected void onPostExecute(String result) {
         super.onPostExecute(result);
  
      }
      }
  </code></pre>
  
  <p>EDITTED:
  This is my activity_main.xml code</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context="com.project.unityapp.MainActivity" &gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="@string/hello_world" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>my application is not opening the url on launch. Kindly assist.</p>