Intent is a message-passing class that can start some componentsRole:1 Start an activity component.The activity component is started by the startactivity()/ startactivity () method of the context class.2 Starting a service componentStarting this component through the method of the context class startService() , you can only perform a one-time operation (such as downloading a file).Through the bindservice () method of the context class3 Send a br
1. Intent. action_chooser = "android. Intent. Action. chooser" indicates an activity selector.Intent provides a static createchooser method, allowing us to easily create such an intent. For specific usage examples, refer to the startwallpaper function of launcher. Java in the launcher application:Private voidStartwallpaper (){Closeallapps (True);FinalIntent pickw
Reference: http://www.cnblogs.com/shitianzeng/articles/2807062.htmlOnnewintent (Intent Intent):When developing an Android app, it's easy to start another activity from one activity and pass some data to the new activity, but there may be a little bit of a problem when you need to get the background activity back to the foreground and pass some data.First, by default, when you start an activity with
Two Methods for Intent to pass objects, intent to pass objects
Android provides two methods for passing object parameter types for intent.
The entity classes must implement the Serializable and Parcelable interfaces respectively.
First, we need to know that to pass an object, we need to serialize the object first.
I. Why object serialization?
1. Permanently Save
Differences between android Intent PendingIntent and android intent
Meaning: intent indicates the intention. pending indicates the upcoming or coming thing.The PendingIntent class is used to handle upcoming events. For example, in Notification, it is used to jump to a page, but not to jump to the page immediately.Intent is started in time.
If an intent request executes an action on a piece of data, how does Android know which application (and component) can respond to this request? Intent filter is used to register activity, service, and broadcast referers to execute an action on certain data.
Using intent filter, app components tell android that they can provide services for the action requests o
In a project, it is composed of multiple Activity programs. At this time, communication between these Activity programs is required, and communication between these activities is completed by Intent. Intent operation method supported by the Activity program
No.
Method
Type
Description
1
Public void startActivity (Intent
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:
Intent is divided into two main categories:(1) dominant (Explicit)(2) recessive (implicit)For implicit intent, at some point, an application simply wants to start a component with a certain feature and does not want to be coupled with a particular component. The purpose of this high-level decoupling can be easily achieved by using intent. ( component Start-up bet
Intent matching rules and intent matching rules
This article is translated from the Android API Guide and has been sorted out.
Intent matching rules: perform three tests: action, data, and category.
1. Test the action:
A filter can define zero or multiple actions. If Intent does not contain an action, it passes this te
How to avoid the black screen problem after Intent. FLAG_ACTIVITY_NEW_TASK | Intent. FLAG_ACTIVITY_CLEAR_TASK, activityintentflag
In my own project, I need to use Intent. FLAG_ACTIVITY_NEW_TASK | Intent. FLAG_ACTIVITY_CLEAR_TASK to start a new activity and remove all previous activities. The code for using this
We have learned how to call an activity in a single application. However, an important aspect in android development is to use intent to call the activity of other applications. In particular, your application can call many "built-in" applications in the system. The so-called "built-in" application refers to applications at the same level, such as Browser, Phone, and Sms. For example, if your application needs to open a webpage, you can use the
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 intent description, is responsible to find the corresponding component, the
Intent. addflags (intent. flag_activity_no_animation );
Flag_activity_brought_to_front
This flag is not set by the program code. For example, the system helps you set the singletask mode in launchmode.
Flag_activity_clear_top
If it is set and the activity is already running in the current task, it is no longer to restart an instance of the activity, but all the activities on the activity will be closed,
What is the difference between intent. putextra (bundle) and direct transfer with intent. putextra ("XX", YY )?
Reply
Guangdong-worms (346345565) 15:39:44
Let me answer this question.
Reply
Guangdong-worms (346345565) 15:39:54
I want to criticize you first
Reply
Guangdong-worms (346345565) 15:40:00
First, this is not a problem at all.
Reply
Guangdong-worms (346345565) 15:40:09
Second, this problem can be so
Intent implicit intent is that no specified component can have more than one1, 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 BB.setonclicklistener (this); To implement the implements Onclicklistener interface at this timeImplementing the OnClick methodTh
There are four kinds of intent common1, 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 BB.setonclicklistener (this); To implement the implements Onclicklistener interface at this timeImplementing the OnClick methodpublic void OnClick (View v){Definition Intent
Android Intent and android Intent
1 ntent. setType ("image/*"); // image Format 2 3 intent. setType ("audio/*"); // select audio 4 5 intent. setType ("video/*"); // select the video (mp4 3gp is the video format supported by android) 6 7 intent. setType ("video/*; image/*");
;
4. Create an activity subclass: secondactivity. java.[Java]View plaincopy
Public class secondactivity extends activity {
@ Override
Public void oncreate (bundle savedinstancestate ){
Super. oncreate (savedinstancestate );
Setcontentview (R. layout. secondactivity );
// --- Get the data passed in using getstringextra ()---
Toast. maketext (this, getintent (). getstringextra ("str1 "),
Toast. length_short). Show ();
// --- Get the data passed in using getintextra ()---
Toast.
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.