Bundle
Bundle介绍
由于Bundle实现了Parcelable接口,所有方便在不同的进程进行数据传输。支持传输的数据类型:基本类型,实现了Parcelable接口的对象,实现了Serializable接口的对象以及特殊对象
Bundle数据编写
Bundle bundle = new Bundle();
bundle.putString("name","FranzLiszt");
Intent intent = new Intent();
intent.putExtras(bundle);
intent.setClass(MainActivity.this, SecondActivity.class);
startActivity(intent);
Bundle读取数据
Bundle bundle = this.getIntent().getExtras();
String name = bundle.getString("name");
Log.d(TAG,name);