NexusOnly NexusOnly - 1 year ago 342
Android Question

Card View Click on Card Move To New Activity

I am new to Android programming and was working on a card layout. I was wondering, how do I make it clickable?


I have that on my card widget and then I wanted to know where to put an on clickable action? I want to be able to click the card, it gets the id of the card, and then displays a new intent activity

This is my code for the activity to load the adapter


RecyclerView recList = (RecyclerView) findViewById(;
LinearLayoutManager llm = new LinearLayoutManager(this);

ContactAdapter ca = new ContactAdapter(createList(30));


Answer Source

If you used the implementation correctly, your code should go like this:

card - is the card view you instantiated to display on your ui


In your implementation of the onClickListener, you should have this:

public void onClick(Card c ,View v) {
    Intent intent = new Intent(MyActivity.this, NextActivity.class);

that is pretty much all you need to start a new activity from the card

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download