Can't set ListView Adapter from AsyncThread
<p>I'm using a <code>ListView</code> on my <code>Activity</code> and it takes a while to load from a SQLite DB, so I wanted to show a <code>ProgressDialog</code> to the user to let them know something is loading.  I tried to run the task on a separate thread but I'm getting a <code>CalledFromWrongThreadException</code>.  Here's my main <code>Activity</code> code:</p>

<pre><code>@Override
public void onCreate(Bundle savedInstanceState) 
{
    try
    {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); 
        setContentView(R.layout.open_issues);
        getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_title);

        //Set Window title.
        final TextView title = (TextView) findViewById(R.id.customTitle);
        if (title != null)
            title.setText("Open Issues");

        //Call Async Task to run in the background.
        new LoadIssuesTask().execute();
    }
    catch (Exception e)
    {
        Errors.LogError(e);
    }
}
</code></pre>

<p>And the LoadIssuesTask code:</p>

<pre><code>private class LoadIssuesTask extends AsyncTask&lt;Void, Void, Cursor&gt; {

    ProgressDialog pdDialog = null;
   protected void onPreExecute()
   {
       try
       {
           pdDialog = new ProgressDialog(OpenIssues.this);
           pdDialog.setMessage("Loading Issues and Activities, please wait...");
           pdDialog.show();
       }
       catch (Exception e)
       {
           Errors.LogError(e);
       }
   }

   @Override
   protected Cursor doInBackground(Void... params) {
       LoadIssues();
       return null;
   }

   @Override
   protected void onPostExecute(Cursor c) {
       pdDialog.dismiss();
       pdDialog = null;
   }
 }
</code></pre>

<p>And the LoadIssues code:</p>

<pre><code>private void LoadIssues(){
    //Set listview of Issues.
    ListView lvIssues = (ListView)findViewById(R.id.lvIssues);
    lvIssues.setOnItemClickListener(viewIssuesListener);

    IssueCreator = new IssueInfoCreator(this, Integer.parseInt(AppPreferences.mDBVersion));
    IssueCreator.open();
    lvIssues.setAdapter(new IssueInfoAdapter(this, IssueCreator.queryAll()));        
    IssueCreator.close();
}
</code></pre>

<p>Constructor for IssueInfoAdapter:</p>

<pre><code>public IssueInfoAdapter(Context c, List&lt;IssueInfo&gt; list){
    mListIssueInfo = list;

    //create layout inflater.
    mInflater = LayoutInflater.from(c);
}
</code></pre>

<p>It's throwing the error on the .setAdapter method inside <code>LoadIssues()</code>.
ERROR:</p>

<pre><code>03-12 10:41:23.174: E/AndroidRuntime(11379): Caused by: android.view.ViewRootImpl$CalledFromWrongThreadException: 
Only the original thread that created a view hierarchy can touch its views.
</code></pre>
