The step of communicating data using the bundle:
Mainactivity:
- Create a new Intent, and initialization
- Create a Bundle
- PutCharSequence call function key-value pair is inserted (according to the type of Value may be)
- Use intent.putExtras (bundle) transmitting bundle
- startActivity (intent) to boot activity of
Main2activity:
- 获取Intent:Intent intent =getIntent();
- 获取bundle:Bundle bundle =intent.getExtras();
- Use bundle.getString (key) Get value (depending on the type of Value)
Call another activity and return the result of steps:
Mainactivity:
- Create a new Intent, and initialization
- Using the startActivityForResult (intent, code) ; function and populate objects and intent parameters requestcode (code custom values, e.g. ox11)
optionActivity:
- Initialization intent and bundle, and to return data into a bundle
- intent.putExtras(bundle);
- Use setResult ( code , Intent); returns the content provided
- Finish();