Add customData for get in onClickListener() any data. Like id, url and any other information that we insert into the adapter.
For example:
class GenreAdapter(var list: List<Genre>) : BubblePickerAdapter {
override val totalCount: Int
get() = list.size
override fun getItem(position: Int): PickerItem {
val item = PickerItem()
val genre = list[position]
item.title = genre.name
item.customData = genre.id
return item
}
}
Result:
picker.listener = object : BubblePickerListener {
override fun onBubbleDeselected(item: PickerItem) {
if (item.customData != null && item.customData is Int) {
// Using id
}
}
override fun onBubbleSelected(item: PickerItem) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}
Add customData for get in onClickListener() any data. Like id, url and any other information that we insert into the adapter.
For example:
Result: