Intent implicit intent

Source: Internet
Author: User

Intent implicit intent is that no specified component can have more than one

1, first in the mainactivity to establish a button class B,
Then use Setcontentview (R.layout.activity_main) to find the button,
Let B = (Button) setcontentview (R.layout.activity_main);
Add Mouse events for B
B.setonclicklistener (this); To implement the implements Onclicklistener interface at this time
Implementing the OnClick method

The activity to jump must be configured with the appropriate XML file

<activity
Android:name= "Com.example.Intenthaha.Activity_01" >
<intent-filter>
<action android:name= "Com.zxw51.haha"/>

<category android:name= "Android.intent.category.DEFAULT"/>

<data android:scheme= "http" android:host= "www.baidu.com" android:port= "9090" android:path= "/haha"/>

</intent-filter>

</activity>
<intent-filter> for intent filter as long as you match the action name and category name to jump

Data can be set after the URL HTTP protocol for the domain name port number and address need to intent. SetData (Uri. Parse ())

public void OnClick (View v)
{
Definition Intent Intent = new intent ();
Intent.setaction ("Action name string");
Intent.addcategory (Intent.category.DEFAULT);
Intent.setdata (Uri.parse ("Http://www.baidu.com:9090/haha"));


StartActivity (Intent);
}

Intent implicit intent

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.