Bundle class

1. Create a new class Bundle
  Bundle Bundle the bundle new new = ();
2.Bundle placed class data (in the form of key-value, which takes another Activity data, the key value by a value to find the corresponding value)
  the bundle. putString ( "key", "value");
3. intent to create a new object is added to the bundle and the intent to subject
  the Intent the Intent intent = new new ();
  intent.putExtras (bundle);
4. acquiring key corresponding to the value
  = the bundle its getIntent the Bundle () getExtras ();.
  String Data = bundle.getString ( "Key");

 

Bundle is a simple data packet carrying the object also contains methods to deposit a plurality of data:


putXxx (String key, Xxx data) : into Int, Long and other types of data to the Bundle
putSerializable (String key, Serializable data) : into a sequence of objects to the Bundle

extracted data carrying bag Bundle method of data:

getXxx (String Key): remove Int, Long and other types of data from the Bundle
getSerializable (String Key, the serializable data): remove a serializable object from Bundle

Guess you like

Origin www.cnblogs.com/geili/p/10964267.html