@Override public void setData(RecommendContent data) { super.setData(data); recommendContent = data; simpleDraweeView1.setImageURI(Uri.parse(recommendContent.getImgUrl1())); simpleDraweeView2.setImageURI(Uri.parse(recommendContent.getImgUrl2())); title1.setText(recommendContent.getTitle1()); title2.setText(recommendContent.getTitle2()); content1.setText(recommendContent.getContent1()); content2.setText(recommendContent.getContent2()); cardView1.setOnClickListener(this); cardView2.setOnClickListener(this); }
@Override public void onClick(View v) { Bundle bundle = new Bundle(); switch (v.getId()) { case R.id.recommend_cardview1: bundle.putString("search", recommendContent.getTitle1()); break; case R.id.recommend_cardview2: bundle.putString("search", recommendContent.getTitle2()); break; } Intent intent = new Intent(); intent.putExtra("search", bundle); intent.setClass(getContext(), SearchActivity.class); getContext().startActivity(intent); }