简体   繁体   中英

How i can get selected item from ListView?

我需要从android中的ListView获取选定的项目。

You would use similar code to the following:

ListView lv = (ListView)this.findViewById(android.R.id.list);
lv.setOnItemClickListener(new OnItemClickListener()
{
    public void onItemClick(AdapterView<?> parent, View view, int position, long id)
    {
        // Your code goes here.
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM