Intent参数传递

当Activity与Activity/Service 参数传递,常用方法就是通过Intent实现
例子:

发送代码:
  1. Intent intent = new Intent(...);  
  2. Bundle bundle = new Bundle();  
  3. bundle.putString("param""value");  
  4. intent.putExtras(bundle);  
  5. context.startActivity(intent); 或 context.startService(intent);  
接收代码:
  1. Bundle bunde = intent.getExtras();  
  2. String name = bunde.getInt("param");  


注意键值要一致。

posted @ 2011-09-06 15:35  自然大道  阅读(704)  评论(0编辑  收藏  举报