activity用Intent进行通信。
<span style="font-family:SimSun;font-size:14px;">import java.util.HashMap;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class TestNew extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = new Intent();
Person p = new Person();
p.map = new HashMap<String,String>();
p.map.put("yes", "ido");
p.name="ok";
intent.putExtra("yes", p);
intent.setClass(this, Test.class);
startActivity(intent);
}
} </span>