Adapter for list view
<p>please guide me with this program. Why do we need to use an array adapter to show the list? What is this "adapter", and can we display things directly in the ListView, without an adapter? Like, can we set setListAdapter(names) instead of setListAdapter(adapter);? Thanks.<br>
Here is the code:</p>

<pre><code>import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;

public class Episode7 extends ListActivity {


    String[] names = {
        "Elliot","Geoffrey","Samuel","Harvey","Ian","Nina","Jessica",
        "John","Kathleen","Keith","Laura","Lloyd"
    };

    /** Called when the activity is first created. */
    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        // Create an ArrayAdapter that will contain all list items
        ArrayAdapter&lt;String&gt; adapter;

        /* Assign the name array to that adapter and 
           also choose a simple layout for the list items */ 
        adapter = new ArrayAdapter&lt;String&gt;(
                this,
                android.R.layout.simple_list_item_1,
                names);

        // Assign the adapter to this ListActivity
        setListAdapter(adapter);
    }
}
</code></pre>
