Note that there are some explanatory texts on larger screens.

plurals
  1. POonitemclick() returns wrong value
    primarykey
    data
    text
    <p>i have an onitemclicklistener() implemented in my listview that shows all my database info</p> <pre><code>onitemclick((AdapterView&lt;?&gt; parent, View viewClicked, int position, long bezoeknummer) </code></pre> <p>shown snippet of code returns me the first column value of that specific database row.</p> <p>how can i make it return the 2nd column of that database row? </p> <p>i tried already to make my cursor query to read the desired (2nd column value) as _id instead of my first row value but then my program crashes</p> <p>edit,</p> <p>i have following code for the onitemclick</p> <pre><code>private void herkenlijstklik() { ListView bezoelijst = (ListView) findViewById(R.id.listViewAbezoe); bezoelijst.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View viewClicked, int position, long bezoeknummer) { Log.i("herkenlijstklik", "nummer gepaseerd door onitemclick, zou moeten hetzelfde zijn als bezoeknummer = " + bezoeknummer); } }); </code></pre> <p>my cursor for my listview is formed as shown below out of my database</p> <pre><code>public Cursor leesallegegevens() { String waar = null; Cursor c = onzedatabase.query(true, databasetabel, allekolommen, waar, null, null, null, null, null); if (c != null) { c.moveToFirst(); } Log.i("cursor leesallegegevens", c.toString()); return c; } </code></pre> <p>to ask again my question:</p> <p>my database exists of multiple columns, the function Onitemclick() returns me the first column of that database what i my variable called long bezoeknummer to return is in the 2nd column</p> <p>as the code is shown i do not have any errors in the logcat, only the wrong value returned</p> <p>please help me how to return the desired value, please do not hesitate to ask more questions if necesary</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.
 

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