I want to g开发者_C百科et the index of the Selected Item ( Clicked ) in a ListView.
Can any one please tell me?
Thanks Deepak
You need to use an AdapterView
and its onItemClick method :
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> list, View v, int pos, long id) {
yourAdapter.getItem(pos);
}
});
精彩评论