Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to set a simple adapter to listview?
    primarykey
    data
    text
    <p>I have problem adding arraylist to list view, will explain about my problem here.. tell me what is wrong here... I have three linear layouts, and in the middle layout i have list view, as shown in the xml file below.. ` </p> <pre><code> &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;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" /&gt; &lt;Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;/LinearLayout&gt; &lt;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" &gt; &lt;ListView android:id="@+id/listview_grouplist" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" &gt; &lt;/ListView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/linearLayout2" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;Button android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.39" android:text="TextView" /&gt; &lt;Button android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt;` </code></pre> <p>when I try to add items to the list with array adapter, its working fine for me..but its not working for List Adapter. It is crashing. </p> <pre><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&lt;String&gt; adapter1 = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, values); lst_projlist.setAdapter(adapter1); </code></pre> <p>could someone tell me what is missing here ?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload