How to open new activity after cardview clicked ? I have CardView and RecyclerView, then I loop my data with RecycleView.
Asked
Active
Viewed 838 times
-3
-
to start navigation from one activity to another activity new Intent(startActivity(MainActivity.this, SecondActivity.class)); – Mohammad nabil May 18 '17 at 07:00
-
Next time search for `"android how to open new activity"` first. – Denny May 18 '17 at 07:01
2 Answers
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