首先Intent作为一个意图用来打开指定的Activity,
intent 可以携带数据,然后在目的Activity中获取该数据
Main.class
Intent intent = new Intent(context,Destination.class);//指定目的
Bundle bundle = new Bundle();
bundle.putXX(key,value); //value为放入XX类型的数据 ,key 是后面要用到的key
intent.putExtras(bundle); //携带了数据
intent.putExtras(name, bundle); //这里的name和上面的key类似,用来区分不同的bundle,因为intent可以携带很多不同的bundle,
----------------------------------------------------------------------------------------------------------------------------------------------
Destination.class
上下文环境中获取到 intent /Bundle
getIntent(); //intent
getIntent().getExtras(); //bundle
getIntent().getBundleExtra(name); //根据前面使用的name来获取该对应的Bundle
getIntent().getSerializableExtra(key); //序列化后的XX类型对象
getIntent().getExtras().getSerializable(key); //序列化后的XX类型对象