For the development of the app, the transmission of data is certainly indispensable, in fact, the essence of the app is to present the data.
Good
Way One Intent.putextra (Tag,data);
The application scenario is for transmitting a single data, but only between two activity.
Issue Sendactivity
Intent intent=new Intent (sendactivity.this,receiveactivity.class);
Intent.putextra (Tag,data);
StartActivity (Intent);
Receive Receiveactivity
Under the OnCreate () method of receiveactivity
String name=getintent (). Getintextra (TAG);
Note: TAG is a string flag
Data can be a string, Int,bool, and so on.
Mode two Intent.putextras (Bundle);
Application scenario pairs with multiple data and only between two activity.
Issue Sendactivity
Intent intent=new Intent (sendactivity.this,receiveactivity.class);
Bundle Bundle=new Bundle ();
Bundle.putstring ("Data One", data i );
Bundle.putstring ("Data Two", data two );
Bundle.putstring ("Data three", Data III );
。。。。
Intent.putextras (bundle);
StartActivity (Intent);
Receive Receiveactivity
Data one =this.getintent (). Getextras (). getString ("Data One");
Data two =this.getintent (). Getextras (). getString ("Data II");
Data three =this.getintent (). Getextras (). getString ("Data Three");
。。。。
Note Bundle is an object that encapsulates data, and I don't know how you understand it, so I understand that it can encapsulate many types.
Way three Application
Scenario pairs with multiple data or but individual data can be defined according to their own requirements
The Android:name attribute of the Applicaion node to Androidmanifest.xml is required plus the application class name.
Several ways of transmitting values between Android Acitivity (^_^)