- 以下代码由网友提供,未经测试。
- 发送
- Bundle bundle = new Bundle();
-
bundle.putSerializable("test", new SB(1,2));
-
Intent intent = new Intent(this, MyScreen.class);
-
intent.putExtras(bundle);
-
startActivity(intent);
接收
-
protected void onCreate(Bundle savedInstanceState)
-
{
-
// TODO Auto-generated method stub
-
super.onCreate(savedInstanceState);
-
setContentView(R.layout.djx2);
-
Bundle bundle=this.getIntent().getExtras();
-
s=bundle.getString("name");
-
SB sb=(SB)bundle.getSerializable("test");
-
System.out.println(sb.posy);
- }