I have got some Objects shown in a ListView. For that reason I've got a class just for the Objects with 2 attributes: "name" and "price" (Yes, no ID, because I set the datatype in my SQLite Database to integer, primary key, autoincrement.)
In my Activity class, I've got an ArrayList filled with all of the Objects, which are in the Database (which works fine)
Now, I have added a onItemClick method.
public boolean onItemLongClick(AdapterView<?> parent, View convertView, final int position, long id)
And there is the problem: trying to delete the object (I've written my own delete method which works fine, but needs an ID as parameter) is not working, because the ID in the database is not equal to the POSITION in the ListView.
I've wondered about the 4th argument in the method (long id), but it's showing the value 0 for every ListView Item
Any Ideas how I can get the proper Id to each ListView Item position (which will still work fine if Items are getting deleted) ?