Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just use a ListView!</p> <p>It's the easiest to set up and easiest to maintain. You define an XML layout for the List-Row, and an XML layout for the View which holds the entire List. The ListAdapter does the rest for you. </p> <p>Just create a: </p> <pre><code>List&lt;HashMap&lt;String, String&gt;&gt; services = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); </code></pre> <p>...and loop through your data to add as many items as you like to the Map. Then set this map to your ListAdapter. Whether 10 items or 100 items the ListAdapter will create a List with that many items.</p> <p>Example:</p> <pre><code> public void updateProductList(String searchTerm) { createOrOpenDB(this); Cursor cursor = (searchTerm!=null)? dbAdapter.fetchWhere(TBL_NAME, KEY_NAME+" LIKE '%"+searchTerm+"%'") : dbAdapter.fetchAll(TBL_NAME); int rows = cursor.getCount(); if (rows&lt;=0) return; services.clear(); //clear current list for (int i=0; i&lt;rows; i++) { HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); cursor.moveToPosition(i); map.put(KEY_NAME, "" + cursor.getString(cursor.getColumnIndex(KEY_NAME))); map.put(KEY_DESC, "" + cursor.getString(cursor.getColumnIndex(KEY_DESC))); map.put(KEY_COST, "" + cursor.getDouble(cursor.getColumnIndex(KEY_COST))); services.add(map); } cursor.close(); closeDB(); ListAdapter adapter = new SimpleAdapter(this, services, R.layout.products_view_row, new String[] {KEY_NAME, KEY_DESC, KEY_COST}, new int[] {R.id.listViewText1, R.id.listViewText2, R.id.listViewText3}); setListAdapter(adapter); } </code></pre>
    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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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