In this section, I do not want to continue with Android interface development. Instead, I want to talk about Intent. Later, I may make the QQ login interface and chat interface, however, the chat interface may be considered after I have reviewed the Sqlite database, but I should record the content of this section for future reference.
Intent is used to start an Activity, Service, or BroadCast.
1. You can use setClass or set the original Activity or target Activity in the constructor to display the specified jump object.
2. You can also use the setAction method to set the Action attribute (a string) for the Intent object, and then start intent. intent-filter of Activity registration information in xml automatically filters objects that meet the conditions.
Note:
The newly created Activity must be in AndroidManifest. if <intent-filter> </intent-filter> is not registered in xml, you only need to configure the name. However, if intent-filter exists, it must contain
<Action/> and <category/> attributes. The category attribute of a common Activity can be <category android: name = "android. intent. category. DEFAULT"/>.
/***** Example *****/
AndroidManifest. xml
<Intent-filter>
<Action android: name = "Action information"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter>
MainActivity. java
Intent intent = new Intent ();
Intent. setAction ("Action Inforation ");
StartActivity (intent); // note that the form of Action Information here is arbitrary, but it must not conflict with other activities
/****************/
3. You can use addCategory to set category to further limit the Activity to be started.
AndroidManifest. xml
<Intent-filter>
<Action android: name = "Action information"/>
<Category android: name = "TSIDJ"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter>
MainActivity. java
Intent intent = new Intent ();
Intent. setAction ("Action Inforation ");
Intent. addCategory ("TSIDJ ");
StartActivity (intent );
// Note that the addCategory () attribute indicates that an additional attribute is added. Note: 1. The DEFAULT attribute of categeory cannot be omitted; 2. category cannot jump to an Activity independently, but Action can jump to an Activity independently. category is only used as an additional condition, that is, if the action/data information is the same and the category information is different, the Activity cannot be started.
Let's write so much today. We should have a rest early ..