title: update listview with asyncTask
body: <p>I'm trying to download some data from yahoo finance and display them on screen with a listview.
  I collect data well, my problem is to update the listview and delete data
  Antique array.</p>
  
  <p>here I leave my code:</p>
  
  <pre><code>public class Fragment1 extends Fragment {
  
  static List&lt;String[]&gt; datos = new ArrayList&lt;String[]&gt;();
  static ListView lv;
  static ArrayList nombres = new ArrayList();
  static ArrayList valores = new ArrayList();
  
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
      View v = inflater.inflate(R.layout.fragment_1, container, false);
      messageList(v);
  
      return v;
  }
  
  private void messageList(View v) {
      adapter adapter = new adapter(getActivity(), null);
      ArrayAdapter&lt;String&gt; adaptador = new ArrayAdapter&lt;String&gt;(
              getActivity(), android.R.layout.simple_list_item_1, valores);
      new MyLongTask().execute(adaptador);
  
      for (int i = 0; i &lt; datos.size(); i++) {
          for (int e = 0; e &lt; 4; e++) {
              nombres.add(datos.get(i)[e]);
          }
      }
      datos.clear();
      valores = nombres;
      System.out.println(valores);
  
      lv = (ListView) v.findViewById(R.id.listView1);
      lv.setAdapter(adaptador);
  
  }
  
  static class MyLongTask extends AsyncTask&lt;ArrayAdapter&lt;String&gt;, Void, Void&gt; {
  
      protected void onPreExecute(ArrayAdapter&lt;String&gt; adaptador) {
          // Avísele al usuario que estamos trabajando
      }
  
      @Override
      protected Void doInBackground(ArrayAdapter&lt;String&gt;... params) {
          System.out.println("entra en el hilo");
          datos.clear();
          String next[] = {};
          List&lt;String[]&gt; list = new ArrayList&lt;String[]&gt;();
          try {
              URL url = new URL(
                      "http://finance.yahoo.com/d/quotes.csv?s=AAPL+GOOG+MSFT&amp;f=nab2b3");
              InputStreamReader in = new InputStreamReader(url.openStream());
              CSVReader reader = new CSVReader(in);
              for (;;) {
                  next = reader.readNext();
                  if (next != null) {
                      list.add(next);
  
                  } else {
                      break;
                  }
              }
              datos = list;
  
          } catch (IOException e) {
              System.out.println(e);
          }
          try {
              Thread.sleep(200);// 2000 es 2 segundos
          } catch (InterruptedException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          System.out.println("sale del hilo");
  
          return null;
      }
  
      protected void onPostExecute(ArrayAdapter&lt;String&gt; adaptador) {
          adaptador.notifyDataSetChanged();
          System.out.println("onpostexecute");
          new MyLongTask().execute();
      }
  }
  
  }
  </code></pre>