OnItemClickListener using ArrayAdapter for ListView

后端 未结 4 1569
Happy的楠姐
Happy的楠姐 2020-11-29 05:18

I want to have an OnItemClickListener for a ListView I create using an ArrayAdapter

This is the code I use to create it:

List values =         


        
4条回答
  •  青春惊慌失措
    2020-11-29 06:00

    i'm using arrayadpter ,using this follwed code i'm able to get items

    String value = (String)adapter.getItemAtPosition(position);

    listView.setOnItemClickListener(new OnItemClickListener() {
    
            @Override
            public void onItemClick(AdapterView parent, View view,
                    int position, long id) {
                 String string=adapter.getItem(position);
                 Log.d("**********", string);
    
            }
        });
    

提交回复
热议问题