Android display and implicit Intent Intent

1. Display the onclick method Intent Intent intent = new Intent (FirstActivity.this, SecondActivity.class); startActivity (intent); 2. Implicit Implicit Intent Intent is not clear that what we want to start an activity, but a designated more abstract action series and category information, and then handed over to the system to analyze the intent, and to help us find the right Intent to start by Under Label Configuration Content, specify the currently active and able to respond to the action category. Add the following code AndroidManifest.xml //Package names Then click event implemented in FirstActivity in: Intent intent = new Intent ( "com.example.activitytext.ACTION_START"); intent.addCategory ( "com.example.activitytext.MY_CATEGORY"); startActivity (intent); see an error message It reminds us that no activity can respond to our Intent. This is because we added a new category and the configuration file does not declare can respond to this category. Just add it in the configuration file Implicit Intent to other uses 1. You can enter by clicking on the event to a different browser: eg onclick () method to write Intent intent = new Intent (Intent.ACTION_VIEW); intent.setData (Uri.parse ( "http: / /www.baidu.com"));// () method to resolve a URL into a Uri object by Uri.parse, () method passing into this call the Intent setData Uri object. startActivity (intent); we can Medium arrangement Host for the host name portion of the specified data:: tags, used to more accurately specify the flight activities that can be declared in response to the data type android:. Scheme data for specifying the protocol section: http portion such as www.baidu.com portion android android: port is used to specify the data port to play part of the general android immediately after the hostname: path part after living for residents and port designated as a period of URL contents following the domain name. android: mineType used to develop the data type that can be processed, allowing the use of wildcards specified manner. onlyWhen the label key content and intent of Data carried exactly the same, the currently active dog to respond to the Intent. In generalTag does not specify too much content.

Guess you like

Origin www.cnblogs.com/hy-nobug/p/12129464.html