How can I count on listview item on click?

Viewed 32

In my code im creating persons and go with them into a list per button click. From this list, It shows all created persons(items) in listview.

So I want to count for every click. Example:

Im Creating Person Max:

You can see max in listview now

When Im creating a second person

**Im want to count like this:

max count : 0

second person count : 0

Click on Max count++

max count : 1 second person count : 0

Below is the code:

listView.setOnItemClickListener{ adapterView, view, i, l ->
 Toast.makeText(this, "Item Selected " +personNamelist[i], Toast.LENGTH_LONG).show()
clickList.add(Person(personNamelist[i], 0))
                    clicks++
0 Answers
Related