OkHttp, Android - download a html page and display this content in a view
<p>I would like download a html page in order to display some information in a TextView. Everytime, my program displays "error" in the TextView. Why doesn't my program  work ?</p>

<p>I add in the AndroidManifest.xml file, this line:</p>

<pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
</code></pre>

<p>Here my activity_main.xml file:</p>

<pre><code>      &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &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="blabla.test.mainactivity"&gt;

          &lt;textview
              android:id="@+id/aff"
              android:layout_width="100dp"
              android:layout_height="100dp"
              android:text="error" /&gt;
      &lt;/relativelayout&gt;
</code></pre>

<p>And here my MainActivity.java:</p>

<pre><code>    package blabla.test;

    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.util.Log;
    import android.widget.TextView;

    import java.io.IOException;

    import okhttp3.Call;
    import okhttp3.Callback;
    import okhttp3.OkHttpClient;
    import okhttp3.Request;
    import okhttp3.Response;


    public class MainActivity extends AppCompatActivity {

        public static String test = "error";

        @Override
        protected void onCreate(Bundle savedInstanceState)  {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);

            String url = "http://square.github.io/okhttp/";
            OkHttpClient client = new OkHttpClient();
            Request request = new Request.Builder()
                    .url(url)
                    .build();

            client.newCall(request).enqueue(new Callback() {
                @Override
                public void onFailure(Call call, IOException e) {
                    Log.e("APp", e.toString());
                }
                @Override
                public void onResponse(Call call, Response response) throws IOException {
                    if (response.isSuccessful()) {

                       MainActivity.test = response.body().string();
                        }else{
                            Log.e("APp", "Error");
                        }
                    }
                });

            TextView aff = (TextView) findViewById(R.id.aff);
            aff.setText(MainActivity.test);
            }
        }
</code></pre>

<p>I thank you in advance for your help :)</p>