Activity之间的消息传递:
Activity1: Intent intent=new intent(Activity1.this,Activity2.clas); Bundle data=new data(); data.putString("name",name); intent.putExtras(data); StartActivity(intent); Activity2: Intent intent=getIntent(); Bundle data=intent.getExtras(); String name=data.getString("name);
Activity消息回传:
Activity1: Intent intent=new Intent(); Bundle data=new Bundle(); data.putString("name","kok"); intent.putExtras(data); intent.setClass(Activity1.this,Activity2.class); startActivityForResult(intent,0); 实现onActivityResult函数接口: protected void onActivityResult(int requestCode,int resultCode,Intent intent) { Bundle data=intent.getExtras(); String name=data.getString("name"); } Activity2: Intent intent=getIntent(); Activity2.setResult(0,intent); Activity2.this.finish();