Wie setze ich einen einfachen Adapter auf Listview?

Ich habe Probleme beim Hinzufügen von Arraylisten zur Listenansicht. Hier wird das Problem erläutert. Sagen Sie mir, was hier falsch ist. Ich habe drei lineare Layouts. Im mittleren Layout habe ich eine Listenansicht, wie in der folgenden XML-Datei gezeigt. . `

<code> <LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_weight="0.59"
        android:src="@drawable/x_title" />

    <Button
        android:id="@+id/button3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout_grouplist"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0.09"
    android:orientation="vertical"
    android:weightSum="1" >

    <ListView
        android:id="@+id/listview_grouplist"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >
    </ListView>

</LinearLayout>

<LinearLayout
    android:id="@+id/linearLayout2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <Button
        android:id="@+id/button4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0.39"
        android:text="TextView" />

    <Button
        android:id="@+id/button5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />
  </LinearLayout>
</LinearLayout>`
</code>

Wenn ich versuche, Elemente mit dem Array-Adapter zur Liste hinzuzufügen, funktioniert dies für mich einwandfrei. Für den List-Adapter funktioniert dies jedoch nicht. Es stürzt ab.

<code>ListAdapter adapter = new SimpleAdapter(this,
      mylist, 
      R.layout.grouplistlayout, 
      new String[] { "Group Name" }, 
      new int[] { R.id.listview_grouplist });

String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
      "Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
      "Linux", "OS/2" };

ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, values);
lst_projlist.setAdapter(adapter1);
</code>

könnte mir jemand sagen was hier fehlt?

Antworten auf die Frage(4)

Ihre Antwort auf die Frage