0

I am using android ChipView library .I didn't found any doc regarding this.

Please refer to this

compile 'com.github.jakebonk:ChipView:1.0.1'

I went through the code but there is no method that return selected tag from the list. Is there any way out?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Dee Nix
  • 170
  • 1
  • 13

1 Answers1

0

You need to keep a list / reference to the items as they are added to the adapter. This is something I created for a similar library:

    participantsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            Timber.d("Item clicked position is: " +position);
            ParticipantChipInput selectedChip =
                    participantChipListAdapter.getParticipantChipInputs().get(position);

            selectedChip.setSelected(!selectedChip.isSelected());

            if (selectedChip.isSelected()) {
                participantChipsList.addChip(selectedChip);
            } else {
                participantChipsList.removeChip(selectedChip);
            }
            participantChipListAdapter.notifyDataSetChanged();
        }
    });
dazza5000
  • 7,075
  • 9
  • 44
  • 89
  • `participantsListView` where would I get this list? There is already a listview inside the library with no public method to access data. – Dee Nix Feb 20 '18 at 18:36