O
O
OM12016-09-06 09:06:43
Android
OM1, 2016-09-06 09:06:43

Android CardView: How to track click on CardView via adapter in main class?

Good afternoon!
There is a cardview and an adapter for it. There is also a map in the main class. How to catch a click on a cardview and handle the click?
The adapter class has a method:

@Override
    public void onBindViewHolder(eventViewHolder personViewHolder, int i) {
       

        personViewHolder.cv_event.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //implement onClick
            }
        });

    }

Everything is clear, it works.
And how to track and process the click from the main class?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
davidnum95, 2016-09-06
@OM1

in the adapter you make an interface and through it you communicate with the activity

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question