Get Selected Item Using Checkbox in Listview

前端 未结 9 880
醉酒成梦
醉酒成梦 2020-11-22 09:36

I am creating an Android application where I have a ListView that displays all of the applications that were installed in my mobile phone.

My ListView is customized,

9条回答
  •  广开言路
    2020-11-22 09:52

    You have to add an OnItemClickListener to the listview to determine which item was clicked, then find the checkbox.

    mListView.setOnItemClickListener(new OnItemClickListener()
    {
        @Override
        public void onItemClick(AdapterView parent, View v, int position, long id)
        {
            CheckBox cb = (CheckBox) v.findViewById(R.id.checkbox_id);
        }
    });
    

提交回复
热议问题