Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to find out which item of the list is click if the item's name are the same?
    primarykey
    data
    text
    <p>So basically I have records from a database, each record has its own unique ID (primary key) and its date(mm:hh mm/dd/yy) I would like to display those records on my app's listview. But having the time(mm:hh) is kind of ugly so i decided to only display the mm/dd/yy on the list, now the question is, when I program the onitemClick, how do I find out which item is being click?? Because I dont have the unique ID and the exact Date displayed on the list anymore.</p> <pre><code>ArrayList&lt;HashMap&lt;String, String&gt;&gt; aList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); HashMap&lt;String, String&gt; map; for (int x = Records.size()-1; x &gt;=0; x--) { map = new HashMap&lt;String, String&gt;(); map.put("ID", String.valueOf(Records.get(x).getId())); map.put("date", Records.get(x).getDate()); //I am going to change this date to just mm/dd/yy aList.add(map); } sd = new SimpleAdapter(this, aList, R.layout.historyactivityrow, new String[] { "date" }, new int[] { R.id.date }); lv.setAdapter(sd); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; arg0, View view, int arg2, long arg3) { TextView tx = (TextView) view.findViewById(R.id.date); String s = tx.getText().toString(); Intent intent = new Intent(HistoryActivity.this, EditRecordActivity.class); intent.putExtra("date", s); //I can't do this anymore because now the EditRecordActivity will not know the exact record to be edited. startActivity(intent); } }); </code></pre> <p>Please help.</p>
    singulars
    1. This table or related slice is empty.
    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. 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