Intent参数传递
当Activity与Activity/Service 参数传递,常用方法就是通过Intent实现
例子:
- Intent intent = new Intent(...);
- Bundle bundle = new Bundle();
- bundle.putString("param", "value");
- intent.putExtras(bundle);
- context.startActivity(intent); 或 context.startService(intent);
- Bundle bunde = intent.getExtras();
- String name = bunde.getInt("param");
注意键值要一致。