Activity间的传值

String name = myEditText.getText().toString();
				 
Bundle data = new Bundle();//实例化Bundle对象
data.putString("name", name);//将姓名信息添加到Bundle对象中
		         
Intent intent = new Intent(MainActivity.this,ResultActivity.class);
intent.putExtras(data);
startActivity(intent);

 

获取传递过来的值:

Intent intent = getIntent();
Bundle b = intent.getExtras();
String name = b.getString("name");

  

你可能感兴趣的:(Activity)