android 意图传值
程序员文章站
2022-05-28 15:01:22
...
当前的acticity
Intent intent = new Intent(getApplicationContext(), SendActivity.class);
intent.putExtra("lbMac", dataBean.getLbMac().replace(" ", ""));
intent.putExtra("orderNo", dataBean.getOrderNo());
intent.putExtra("ProductId", ""+dataBean.getProductId());
intent.putExtra("ProductName", dataBean.getProductName());
startActivity(intent);
跳转的acticity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_send);
ButterKnife.bind(this);
// 首先获取到意图对象
Intent intent = getIntent();
// 获取到传递过来的姓名
lbMac = intent.getStringExtra("lbMac");
orderNo = intent.getStringExtra("orderNo");
ProductId = intent.getStringExtra("ProductId");
ProductName = intent.getStringExtra("ProductName");
}