?? Android uses Intent to pass the object, list, List , Object>
Method 1:
If you simply pass the List Or List Then you can directly use
Java code
Intent. putStringArrayListExtra (name, value)
Intent. putIntegerArrayListExtra (name, value)
Method 2:
If List is passed , You can convert list to Serializable type, and then use
Java code putExtras (key, (Serializable) list)
Method passed, used for acceptance
Java code (List ) GetIntent (). getSerializable (key)
The List can be accepted. Data
But remember that your YourObject class must implement the Serializable interface.
Method 3:
One is
Java code Bundle. putSerializable (Key, Object );
The other is
Java code Bundle. putParcelable (Key, Object );
Of course, these objects have certain conditions. The former implements the Serializable interface, while the latter implements the Parcelable interface.
Method 4:
It is inconvenient to use intent to transmit data. We can write a global data in the application.
1. Create a subclass of your own android. app. Application
2. Declare this class in manifest,
3. In this case, android creates a globally available instance. You can use Context. getApplicationContext () to obtain the instance anywhere else, and then obtain the status (variable ).