What to do to prevent SimpleAdapter from crashing?
<p>I'm trying to populate a ListView... in main.java i have this:</p>

<pre><code>...
    ListViewMain=(ListView)findViewById(R.id.lv1);

    popVidList pvl = new popVidList();
    pvl.populateVideoList(ListViewMain);
...
</code></pre>

<p>and in popVidList.java this:</p>

<pre><code>package rob.youtube.com;

import java.util.ArrayList;
import java.util.HashMap;

import android.app.Activity;
import android.widget.ListView;
import android.widget.SimpleAdapter;

public class popVidList extends Activity {

    private ArrayList &lt;HashMap&lt;String, Object&gt;&gt; vidArray;
    private static final String ListVidText1 = "Mythbusters";
    private static final String ListVidText2 = "by Jamie";
    private static final String ListVidText3 = "3 month ago";
    private static final String IMGKEY = "iconfromraw";


public void populateVideoList( ListView ListViewMain )
{

    vidArray = new ArrayList&lt;HashMap&lt;String,Object&gt;&gt;();
    HashMap&lt;String, Object&gt; hm;

    hm = new HashMap&lt;String, Object&gt;();
    hm.put(ListVidText1, "Mythbusters");
    hm.put(ListVidText2, "by Jamie | 132.123 views");
    hm.put(ListVidText3, "3 month ago | +328 / - 14");
    hm.put(IMGKEY, R.drawable.vid_mb);

    vidArray.add(hm);

    SimpleAdapter adapter = new SimpleAdapter(this, vidArray, R.layout.listview_video, new String[]{ListVidText1,ListVidText2,ListVidText3,IMGKEY}, new int[]{R.id.listvid_text1, R.id.listvid_text2, R.id.listvid_text3, R.id.listvid_img});   
    /// CRASHES HERE. maybe 'this' should be replaced by something?

    ListViewMain.setAdapter(adapter);
    ListViewMain.setChoiceMode(ListView.CHOICE_MODE_SINGLE); 

}

}
</code></pre>

<p>Yet upon launch it crashes. This method worked fine from within main.java, before I moved it out to a separate file.
I guess it could have something to do with this line:</p>

<pre><code>SimpleAdapter adapter = new SimpleAdapter(this, vidArray, R.layout.listview_video, new String[]{ListVidText1,ListVidText2,ListVidText3,IMGKEY}, new int[]{R.id.listvid_text1, R.id.listvid_text2, R.id.listvid_text3, R.id.listvid_img});
</code></pre>

<p>maybe I should replace "this" with something?...</p>
