1、EventBus.getDefault().postSticky(new Message(infoList.get(position)));//粘性事件
startActivity(new Intent(ListActivity.this, DetailsActivity.class));
2、 @Override
public void onStart() {
super.onStart();
EventBus.getDefault().register(this);
}
@Override
public void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
}
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)//对粘性事件进行接收
public void onMessageEvent(Message event) {
String goods_name1 = event.getMessage().getGoods_name();
String likes1 = event.getMessage().getLikes();
String integral1 = event.getMessage().getIntegral();
String img1 = event.getMessage().getImg();
Picasso.with(DetailsActivity.this).load(img1).into(img);
goods_name.setText(goods_name1);
likes.setText(likes1);
integral.setText(integral1);
}
3、定义传值的类Message
即你传什么值定义什么字段