I have an activity that extends ListActivity. I then have a Class which uses View Inflater so I cn fill the list rows out differently depending on values from a cursor adapter.
So for example if one of the "Devices" in my database is a lamp module then create a row with four buttons, off,dim,bright and on.
This all works fine so far. So now I need to deal with the button presses. Within the getView() I define the button for the row and then set an onclick listener for that button.
To test this I put an AlerDialog in the onclick event for the off button. Now when I click an off button on one of he rows I get an Alert Showing up. Great I thought!!
But now the problem is how do I tell which one of the Off buttons was pressed? I need my AlertDialog to show a value from the cursor adapter that matchs the row from which the off button was pressed.
So if I have three rows, called, Light, TV and Heater. And I press the off button on the Light Row I want the alertDialog to say "Light".
I just can't seem to figure ot how to get a relevant value out of it. Everything I tired just returned the last value that the cursor adapter retrieved rather than the one relevant to the row. So in he example above every off button I press just displays Heater.
Any help would be greatly appreciated.