title: Android - setAdapter() in AsyncTask
body: <p>I need to fill the ListView with AsyncTask.
  This code works, the TextView changes to "Begin", then "End". But the ListView is blank, not showing. In the log I see "array = 3".</p>
  
  <pre><code>package a.test3;
  
  import java.util.ArrayList;
  
  import a.test3.MainActivity;
  import a.test3.R;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.app.Activity;
  import android.util.Log;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
  
      GrabURL mt;
      TextView textView;
      ListView lvMain;
      ArrayList&lt;String&gt; result_arr = new ArrayList&lt;String&gt;();
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          textView = new TextView(this);
          lvMain = (ListView) findViewById(R.id.listView1);
  
          mt = new GrabURL();
          mt.execute();
      }
  
      public class GrabURL extends AsyncTask&lt;Void, Void, ArrayList&lt;String&gt;&gt; {             
          @Override
          protected void onPreExecute() {
              super.onPreExecute();
              textView.setText("Begin");
              setContentView(textView);
          }
  
          @Override
          protected ArrayList&lt;String&gt; doInBackground(Void... params) {
              result_arr.add("a");
              result_arr.add("b");
              result_arr.add("c");
              return result_arr;
          }
  
          @Override
          protected void onPostExecute(ArrayList&lt;String&gt; result) {
              super.onPostExecute(result);
  
              Log.d("info", "array = " + result.size());
  
              textView.setText("End");
              setContentView(textView);
  
              ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(MainActivity.this,
                      android.R.layout.simple_list_item_1, result);
              lvMain.setAdapter(adapter);
          }
      }
  }
  </code></pre>
  
  <p>Tell me, please, what am I doing wrong?</p>