I'm making an inventory tracker app for Android
for a practice project. I use SQLite
for the storage and my ListView
displays the contents of the database using a CursorAdapter
. I use CursorLoader
to fetch the data from the database
Each row in my ListView
has a couple of TextViews
and a Button
. I plan to use the Button
to decrement the quantity column/property of the selected item in the database.
Where do I setup the button OnClick
listener? In my Activity
class or my CursorAdapter
class' bindView()
?
Also how can I detect which row the button was pressed on from the button click?
I've already used the ListView's onItemClickListener
to send the user to a detailed Activity that display more info about the current row. That had an id argument that gets passed. So I'm finding an equivalent that I can use for the buttons I put on each row.