Activity 中传递数据
从源Activity 中传递数据
//数据写入Intent Intent openWelcomeActivityIntent=new Intent(); Bundle myBundelForName=new Bundle(); myBundelForName.putString("Key_Name",inName.getText().toString()); myBundelForName.putString("Key_Age",inAge.getText().toString()); openWelcomeActivityIntent.putExtras(myBundelForName); openWelcomeActivityIntent.setClass(AndroidBundel.this, Welcome.class); startActivity(openWelcomeActivityIntent);
目标Activity 中获取数据
//从Intent 中获取数据 Bundle myBundelForGetName=this.getIntent().getExtras(); String name=myBundelForGetName.getString("Key_Name"); myTextView_showName.setText("欢迎您进入:"+name);