Mihawk
Mihawk

Reputation: 49

Create a detail view of a card view

i have followed this tutorial of a RecyclerView with Cardviews and now i would like to open a new activity to show the detailed information of the cardview the user clicks on.

Upvotes: 0

Views: 1035

Answers (1)

user6355963
user6355963

Reputation:

To this action you need to implement an Interface and implement it in your MainActivity , like a listener.

OR

You can use a onClickListener for any particular view. But if you want to start activity for the itemView adapter layout use the holder.itemView clicklistener in the onBindViewHolder method.

holder.itemView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        context.startActivity(new Intent(context,YOUR_ACTICITY.class));
    }
});

Upvotes: 1

Related Questions