title: ASyncTask and returning String array values from one
body: <p>Hello I am trying to create an ASyncTask that will parse data from an XML file in the background and then display that String array data in a ListView.  I am not understanding what I am doing wrong so far, or how to return the String Array values back to my GUI.  Here is the code for what I have so far with it if you need anything else let me know please.  Thank you for looking and giving any suggestions or places to turn to to find out more.</p>
  
  <pre><code>package com.lvlup.kikurself.scotttest;
  
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.util.ArrayList;
  import android.app.ListActivity;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.widget.ArrayAdapter;
  import android.widget.Toast;
  import java.io.IOException;
  import org.xml.sax.SAXException;
  
  //import com.lvlup.kikurself.scotttest.WikiParser.Cm;
  
  public class scottPlayers extends ListActivity {
  
  public class PlayerGet extends AsyncTask&lt;Void, Void, Void&gt;{
  
  
  @Override
  protected void onPostExecute(Void result){
  
  WikiParser p = new WikiParser();
  ArrayList&lt;String&gt; titles = new ArrayList&lt;String&gt;();
  
  try {
      p.parseInto(new URL("http://scottlandminecraft.wikia.com/api.php?action=query&amp;list=categorymembers&amp;cmtitle=Category:Players&amp;cmlimit=500&amp;format=xml"), titles);
  
  } catch (MalformedURLException e) {
  } catch (IOException e) {
  } catch (SAXException e) {}
  
      //String[] values = new String[50]; 
      //values = res;
  
  
  
  
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(scottPlayers.this, R.layout.main, titles);
  
      setListAdapter(adapter);
  
      //final ListView playersList = getListView();
  
  
      /*playersList.setOnItemClickListener(new OnItemClickListener() {
      public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long thisID)
      {
           Object o = (playersList.getItemAtPosition(position));
           String playerName_temp = (o.toString());
  
           Intent newIntent = new Intent(v.getContext(), playerDisp.class);
           newIntent.putExtra("tempN", playerName_temp);
           startActivity(newIntent);
  
      }
      });*/
  
  }
  
   @Override
   protected void onPreExecute() {
    // TODO Auto-generated method stub
    Toast.makeText(scottPlayers.this,
      "onPreExecute \n: preload bitmap in AsyncTask",
      Toast.LENGTH_LONG).show();
   }
  
  
   @Override
   protected Void doInBackground(Void... params) {
    // TODO Auto-generated method stub
  
    return null;
   }
  
  
  }
  
  
  @Override
  public void onCreate(Bundle icicle) {
   super.onCreate(icicle);
  
   setContentView(R.layout.main);
  
   new PlayerGet().execute();
  }
  
  
      //get your data back again with: String fName = getIntent().getExtras().getInt("fname");
  
  
  
  
  }
  </code></pre>
  
  <p>EDIT: I added new code after looking at other examples this is what I have come up with but now when I run this in the Emulator it just shows the background of my Main.xml the list doesn't populate, and if I import this to my phone running ICS it says that there was an error and force closes...I couldn't get this to happen in the emulator for some reason, and there were no errors in the LogCat for the emulator.</p>