First, the basic concept of intent object
-intent is one of the Android application components
The-intent object represents an intention in the Android system
The most important part of-intent is action and data
Second, the basic use of intent object method
Intent Intent = new Intent ();
Intent.setclass (Mainactivity.this,otheractivity.class);
Put the Putextra statement here to hold the data
StartActivity (Intent);
Third, using intent to transfer data between activity
-Store data in intent objects using the Putextra () series method
Intent.putextra ("Com.package.Age", 20);
The stored value is a key-value pair. The first parameter is the name, it needs to include the package name, and the second is a value
-Use the Getxxxextra () series method to extract data from the intent object (in another activity)
Intent Intent = Getintent ()
int age = Intent.getintextra ("Com.package.Age", 10);
XXX is the data type; The first parameter is the name, the package name is required, and the second parameter is the default value, which is the value returned by the data fetch failure.
Android Learning Note (11) Intent