views:

19

answers:

2

I have a listview in my program. the problem is that. the list is in single choice mode and when i select any item i have 4 buttons on the footer of my page for that item.. alll i want is to know that. how can i keep that item selected and while cliking any button i can get the selected item.

A: 

If you are using a ListActivity you can use getSelectedItemId() or getSelectedItemPosition(). Alternatively you can bind your own OnItemClickListener to the ListView object. More information can be found in this tutorial.

Maurits Rijk
A: 

Try this:

listView.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView a, View v, int position, long l) { arrayPosition=position; }

public void onNothingSelected(AdapterView<?> arg0) {
}

});

where arrayPosition is a static integer variable.

Try this if it helps..

Kiran Parmar