Answer the question
In order to leave comments, you need to log in
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
}
});
}
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question