Android (3)

Source: Internet
Author: User

1. When jumping from one activity to another, use the StartActivity (Intent) method
2. A Intent object contains a set of information
Componet Name: The name of another activity
Action: Specify what the other activity will do
Data: Transferred from one activity to another activity
Category (later)
Extras
Flags (later)
Intent similar to request in WebApp


3. Click button to jump to activity sample code

MyButton = (Button) Findviewbyid (R.id.mybutton);
Mybutton.setonclicklistener (New Mybuttonlistener ());

The OnClick method of overwrite Onclicklistener

public void OnClick (View v) {
Intent Intent =a New Intent ();
Intent.setclass (Activity02.this, Otheractivity.class);
Intent.putextra ("Testintent", "" ");
Activity02.this.startActivity (Intent);

---------------------------------------------

Uri uri = uri.parse ("smsto://0800000123");
Intent Intent = new Intent (intent.action_sendto, URI);
Intent.putextra ("Sms_body", "The SMS Text");
StartActivity (Intent);
}


Take it on the other side
Intent Intent = Getintent ();
String value = Intent.getstringextra ("testintent");


Miscellaneous notes:
@+id Add a resource ID
@id and Android:id, referencing an existing resource ID

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.