Intent i = new Intent (curractivity.this, Anotheractivity.class);
I.putextra ("name", "Here you can pass in a variety of common data types,include bundlesIn Anotheractivity, the intent iintent i = getintent () can be obtained through the Getintent () method curractivity. String name = I.getstringextra ("name"), or//to get different types of extra based on the data type passed in, here is a string so use Getstringextra. It is also possible to pass multiple data at once by passing bundles Intent i = new Intent (curractivity.this, Anotheractivity.class); Bundle B = new Bundle (), b.putstring ("name", "Crazybun"), B.putint ("age", 24), there are two ways to pass bundles: I.putextra ("Bundle", b); Use I.get when fetchingBundleExtra ("bundle"); I.putextras(b); Use I.getextra when fetchings(); Then in Anotheractivity//First getintent () gets intentintent i = getintent ();//get bundlebundle B = I.getextra from Is();//after which data is taken from B, string name = B.getstring ("name"); String age = B.getint ("Age");//To prevent a key-value pair from being obtained, you can add a parameter to the Get () method that represents the default value, such as:String father = b.getstring ("Father", "Bun");in this case, if there is no father this key value pair in the bundle, the father will be assigned to Bun .
Transfer parameters between Android learning Note--activity