-3

How to open new activity after cardview clicked ? I have CardView and RecyclerView, then I loop my data with RecycleView.

2 Answers2

0
card.setOnClickListener(...); //card is CardView

Then handel onClick

@Override
public void onClick(Card c ,View v) {
    Intent intent = new Intent(MyActivity.this, NextActivity.class);
    startActivity(intent);
}
Mehraj Malik
  • 14,872
  • 15
  • 58
  • 85
  • How to cange my toast open new activity ? @Override public void onClick(View view) { Toast.makeText(view.getContext(), "This iS " + cityName.getText(), Toast.LENGTH_LONG).show(); } – Gang Klampis May 18 '17 at 07:35
0

if Recyclerview inside cardeview then as below

enter image description here

Vasant
  • 3,475
  • 3
  • 19
  • 33