开发者

getting the index of clicked item in a listview

开发者 https://www.devze.com 2023-01-09 23:46 出处:网络
I want to g开发者_C百科et the index of the Selected Item ( Clicked ) in a ListView. Can any one please tell me?

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);           
    }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消