An intent object contains the following content:
1. component name: name of the activity to be started
2. Action
3. Data
4. Category
5. Extras
6. flags
First, initialize an internal class (listener class) in the first activity class, override onclick () method in the listener class, initialize the intent object in the listener class, and use the intent setclass () the object of the class to which the message is sent and the name of the target class. Use the startactivity (intent) method to send this intent, and finally bind the listener class object to a button, using setonclicklistener (new listener class ).
It should be noted that after an activity is created, a layout file (XML) of the activity is created. When the oncreate () method of the newly created activity is rewritten, setcontent (R. layout. layout file (XML) Method
Associate the activity class with the layout file. After creating an activity, you must register the activity in the androidmainfest. xml file.
Below is a text message sent by AndroidCode
Uri uri = URI. parse ("Small sto: // 09998989");
Intent intent =NewIntent (intent. action_sendto, Uri );
Intent. putextra ("Sms_body","XX, how are you?");
Activity01.This. Startactivity (intent );
Write at the beginningProgramI did not know how to quickly import a class. Later I checked the information and found that eclipse had many shortcut keys. In my next blog, I summarized them. Also, pay attention to the matching between classes.