传值方法一
- Intent intent = new Intent();
- Bundle bundle = new Bundle(); //该类用作携带数据
- bundle.putString("name", "tom");
- bundle.putString("ip","8.8.8.8");
- intent.putExtras(bundle); //为Intent追加额外的数据
传值方法二
- Intent intent = new Intent();
- intent.putExtra("name", "tom");
- intent.putExtra("money", 1098978009L);
获取值
- Bundle bundle=getIntent().getExtras();
- String name=bundle.getString("name");