this information.For direct intent,android does not need to do parsing, because the target component is already very clear, Android needs to resolve those indirect intent, by parsing the intent map to the activity that can handle this i
();
// --- Use the putextra () method to return some
// Value ---
I. putextra ("age3", 45 );
// --- Use the setdata () method to return some value ---
I. setdata (URI. parse ("something passed back to main activity "));
// --- Set the result with OK and the intent object ---
Setresult (result_ OK, I );
// --- Destroy the current activity ---
Finish ();
}
}
5. The code in androidmanifest. xml.[Java]View plaincopy
Package = "n
.2 Implicit intent:A component name is not explicitly specified. A component that is typically used to invoke another app in the app.When you use implicit intent, the Android system goes to find the right component to boot. If intent matches intent filter, the component is launched and
I. Basic points of knowledge1, Label Property: The title of a acivity2. The r file should not be wrongly cited as the bottom of Android.3, Intent.setclass (this, main2activity.class);First parameter: ContextSecond parameter: Bytecode file for the component to be activated4, explicit activation (explicitly specified to activate the component)1) Intent.setclass (this, main2activity.class);2) Intent.setclassname (this, "com.njupt.multiactivity.Main2Activ
specifies an action, the action must be included in the intentfilter action list of the target component; otherwise, the action cannot be matched;
If the intent does not provide a type, the system obtains the data type from the data. Like action, the Data Type list of the target component must contain the intent data type. Otherwise, the data type does not match.
If the data in the
We already know that an activity calls another activity by using an Intent object. To allow other activities to respond, you also need to configure the
[Java]
1. Create a project and create a class: MyBrowserActivity. java. Create an xml file brwoser. xml in res/layout.
2. AndroidManifest. xml
[Java] Package = "net. learn2develop. Intents"Android: versionCode = "1"And
message delivery within an application, such as starting another activity or a services.The componentname of the target component is established through intent's setcomponent and SetClass.2. Implicit mode. ComponentName is empty and is used to invoke components in other apps. Need to contain enough information so that the system can use intent filter to filter action, data, or category in all components to match the target component, based on this in
Intent Intent = new Intent ("Com.abc.def");
StartActivity (Intent);
Activity1 and Activity2 both meet the requirements, Android will pop up the "Complete Action Using" dialog box to allow users to select an activity to perform.
It is noteworthy that to be abl
Android tour-Intent and BroadcastReceiver)
I. Functions and categories of Intent
Intent is a message transmission mechanism that can be used within and between programs. Its main usage is as follows: ① use a class name to explicitly start a service or Activity ② execute the intent
What is Intent? Let's take a look at the definition on the Android Official Website:
An intent is an abstractdescription of an operation to be performed med. it can be used with startActivity tolaunch an Activity, broadcastIntent tosend it to any interestedBroadcastReceiver components, and startService (Intent) or bind
So far, you've learned how to use the intent object to invoke other activity. Next, let's say how the intent object is used.
1. You can pass an action to the constructor of the intent:
StartActivity (New Intent
("net.learn2develop.SecondActivity"));
2. You can specify the activity component directly, like this:
return some value ---I. setData (Uri. parse ("Something passed back to main activity "));// --- Set the result with OK and the Intent object ---SetResult (RESULT_ OK, I );// --- Destroy the current activity ---Finish ();}}5. The code in AndroidManifest. xml. [Java] view plaincopy Package = "net. horsttnann. PassingData"Android: versionCode = "1"Android: versionN
Android Intent source code learningPreface this article mainly introduces Android Intent and analyzes the Intent query and matching process from the Android source code perspective.Intent introduces the meaning of
Overview:Intent (Intent) is primarily to address communication between the various components of an Android application. Intent is responsible for the action of an operation in the application, the action involves data, the additional data is described, Android according to this in
We already know that an activity calls another activity by using an Intent object. To allow other activities to respond, you also need to configure the 1. Create a project and create a class: MyBrowserActivity. java. Create an xml file brwoser. xml in res/layout.2. AndroidManifest. xmlPackage = "net. learn2develop. Intents"Android: versionCode = "1"Android: versi
intent object without a category should always pass the matching test, regardless of what is in the filter. In most cases, this is true. With one exception, Android treats all the implicit intent sent to startactivity () as containing at least one category: "android. Intent
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.