一、将整个Bean类传过去
Bean类里实现 implements Serializable
@Override
public void onClick(int position) {
Intent intent = new Intent(this,WebActivity.class);
HomeBean.DataBean.DatasBean datasBean = list.get(position);
intent.putExtra("datas", datasBean);
startActivity(intent);
}
Intent intent = getIntent();
HomeBean.DataBean.DatasBean datasBean = (HomeBean.DataBean.DatasBean) intent.getSerializableExtra("datas");
String link = datasBean.getLink();
web.loadUrl(link);
二、只将想要的链接或者字段传过去
subjectAdapter.setOnClickListener(new SubjectAdapter.OnClickListener() {
@Override
public void onClick(int position) {
Intent intent = new Intent(getContext(), WebSubjectActivity.class);
intent.putExtra("datas", listBeans.get(position).getLink());
startActivity(intent);
}
});
Intent intent = getIntent();
String link = intent.getStringExtra("datas");
webSubject.loadUrl(link);
网友评论