1. Intent (intention)
Intent is a set of information that abstractly describes what behavior you want to perform. It is an object that contains a set of information.
Through it, you can start another activity (StartActivity method); Broadcastintent spread Intent to
Broadcastreceiver components; start-up service: StartService (Intent); Bindservice (..) Go with the backstage
Service communication.
The basic function of 2.Intent (It is an object that contains a set of information)
1.Component name : which Activityto start.
2.Action : For The operation after initiating the Activity.
3.Data : What data do you pass into the specified Activity
4.Extras : Stores a key-value pair and passes it to the specified Activity.
5.Category
6.Flags
/** Demo with one activity (click button to go to another interface) start another activity with intent * 1. Register a button * 2 in this activity. Add a Oncliklistener listener to the button * 3. Write a jump to other activity code on the listener * 3.1 Create a new Intent object, call the SetClass method, and pass in the parameter * 3.2 of the other activity to call the StartActivity (Intent Intent) method. * 4. Note: Another activity needs to create a new XML layout file and register it in the manifest file. */ Public voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.main); Button BT=(Button) Findviewbyid (R.id.mybutton); Bt.settext ("Otheractivity"); Bt.setonclicklistener (NewOnclicklistener () {@Override Public voidOnClick (View v) {//TODO auto-generated Method StubIntent intent=NewIntent (); Intent.setclass (androidprojecttest1activity. This, Otheractivity.class); Androidprojecttest1activity. This. StartActivity (Intent); } }); }
Android-intent (intention) use-< two >