vendredi 1 mai 2015

get position from listview

I retrieve data from sqlite database and I display it into listview. Here the resulting listview:

**Name**
Adam
Frank
James
Mike
.......

With this code clicking on a name I get his position in listview.  

public void onItemClick(AdapterView<?> arg0, View view,
                    int position, long id).

Result:

Adam = position 0

Frank = position 1

James = position 2

Mike = position 3

Now, if I retrieve data with WHERE clause

(e.g. SELECT * from my table WHERE name like "James")

The resulting listview is:

**Name**
James

and clicking on James I get position 0.

How can I get, instead, position 2?

Thank you.

Aucun commentaire:

Enregistrer un commentaire