欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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");
}

相关标签: android android