标签:接收 emd ogg bsp usr tail tac 创建 item
假设现在有两个Activity:A与B,A要向B传递数据。
首先要创建两个Activity:Android:当前Activity跳转到另一个Activity
intent = new Intent(ActivityA.this,ActivityB.class); startActivity(intent);
多了一行 绑定数据 intent = new Intent(ActivityA.this,ActivityB.class); intent.putExtra("data","我是A"); startActivity(intent);
String sData = getIntent().getStringExtra("data").toString();
A向B传递EditView的数据,B在TextView(usrname)中显示
A:
Intent intent = new Intent(munemainActivity.this,itemdetailActivity.class); //设置Intent main_name = (EditText)findViewById(R.id.main_name_in);//获取要传递的信息 String s = main_name.getText().toString(); intent.putExtra("usrname",s); //传递信息 startActivity(intent);
B:
String sData = getIntent().getStringExtra("usrname").toString(); usrname = (TextView)findViewById(R.id.itemdetail_usrname_in); usrname.setText(sData);
Andriod:一个Activity向另一个Activity传递数据
标签:接收 emd ogg bsp usr tail tac 创建 item
原文地址:https://www.cnblogs.com/doggod/p/12105000.html