编程知识 cdmana.com

Summary of four Android components

Preliminary knowledge

1. Intent

Intent It's a messenger , Be responsible for the completion of Android Information transfer between the four components , similar 、 Components of different classes cannot pass objects directly , Once communication is needed, it can only be done through Intent( Passing data through static variables or methods is not recommended , Easy to cause data anomalies 、 Memory leaks and so on ).

2. Life cycle

Life cycle refers to some methods that may be called by the system from creation to destruction of instance objects of components , Each method call has a specific condition , Life cycle methods can be rewritten as needed to perform specific tasks at certain times . Life cycle methods do not recommend calling themselves , It should be managed by the system .

3. Certified components

All four components need to pass through the project AndroidManifest.xml Files can be used after static registration , among BroadcastReceiver You can register dynamically in other components (Android since 6.0 Version begins to restrict static registration , In addition to a small number of broadcast, such as boot broadcast , The static registration of most broadcasts is invalid ).

4. response time

The main application thread did not complete the task within the specified time , The system will report ANR( The application is not responding ) error , Therefore, the time-consuming task should be left to the child thread to complete , The specific time limit and execution location are as follows :

  1. Activity:5 Execution completed in seconds , Including life cycle approaches 、View Touch click events of 、 I / O operations, etc .
  2. Service:20 Execution completed in seconds , It's mainly the life cycle approach .
  3. BroadcastReceiver:10 Execution completed in seconds , Mainly onReceive() Method .

1. Activity

1.1 Basic knowledge

Concept

Activity Literal translation “ Activities ”, One of the applications Activity Can be understood as an interface , It can contain all kinds of layouts and controls to show rich visualization effect , It is mainly used to interact with users . An application must pass through Activity To start and run , An application can have only one Activity, It can also be made up of more than one Activity form .

All in the application Activity Are stored in the system TaskStack In the task stack , Generally, there is only one application TaskStack Task stack , But you can also adjust Activity Start mode to turn on multiple TaskStack Task stack . Since it's called stack , Naturally, there is a stack feature , Currently interactive Activity At the top of the stack , It started first Activity At the bottom of the stack , To the top of the stack Activity Out of the stack, the bottom Activity Be visible to the user and start interacting , The application ends when the task stack is empty .

effect

Activity Is the most intuitive entrance to the application , An application can have no other components , But not without Activity. User IO Operations are made by Activity To deal with , Data display of applications 、 Attractive animation 、 Excellent interface design, etc Activity To display , Users only care about what is visible , No matter how good the effect is, there are no users , No matter how powerful the application is, there must be at least text display, right ?

Life cycle

Activity The life cycle of the book is a rotten book , The most basic knowledge , Never neglect . First of all, we have to draw a picture :
Activity Life cycle
Activity State transition
Life cycles are mostly in pairs :

  1. onCreate() and onDestroy(), The beginning and end of life .
  2. onStart() and onStop(), Whether the interface is visible or not .
  3. onResume() and onPause(), Whether interaction is possible .

Detailed introduction :

  1. onCreate(): The first method called , The layout file is usually loaded in this method 、 Initialize the resource 、 Register events with BroadcastReceiver Wait for a heavier task .
  2. onStart(): stay onCreate() After the method is called , It is usually dealt with in this method UI Display control logic of , The task should not be too heavy , The user cannot interact at this time and cannot directly see the current Activity.
  3. onResume(): stay onStart() After the method is called , Usually, simple data processing and UI control , Like starting animation , Only perform light tasks , After the method is executed, the user can interact and directly see the current Activity. here , At present Activity Get into Resumed state ( Running state ), When one Paused State of Activity When repositioning at the top of the stack ( From the other Activity return ), The method is called again .
  4. onPause(): At present Activity By other Activity Call when overridden , Let the current Activity Get into Paused state ( Pause state ), At this point in time Activity Visible but not interactive . In this method, simple data processing and UI control , Such as pause animation , Only perform light tasks . Out of memory and no other lower priority Activity when , At present Activity It could be destroyed . At present Activity When repositioning at the top of the stack ( From the other Activity return ), Would call onResume() Method .
  5. onStop(): At present Activity By other Activity Full coverage ( If the upper layer Activity When transparent or translucent , Just call onPause() Method ) Called when the , At present Activity Get into Stopped state ( Stop state ), At present Activity invisible . It is usually handled in this method UI Display control logic of , The task should not be too heavy . Out of memory and no other lower priority Activity when , At present Activity It could be destroyed . It's OK. Right now Activity When repositioning at the top of the stack ( From the other Activity return ), Would call onRestart() Method .
  6. onRestat(): When one Stopped State of Activity When returned , The method is called , Call later onStart() Methods and onResume() The method enters the running state .
  7. onDestroy(): At present Activity Called when destroyed , It is usually used in this method to perform heavy tasks such as releasing resources .

start-up

Boot mode

  1. Standard: The standard model ,Activity The default boot mode for . In this mode ,Activity There can be multiple instances , Each start Activity, Whether or not this already exists in the task stack Activity Example , The system will create a new Activity example .
  2. SingleTop: Top of stack mode , To the top of the stack Activity Patterns of reuse . When one SingleTop Mode Activity Already at the top of the stack , If you start it again, you will no longer create a new instance ; If not at the top of the stack , Whether or not this already exists in the task stack Activity Example , The system will create a new Activity example .
  3. SingleTask: Single task mode , Inside the stack Activity Patterns of reuse . If you start Activity Already exists in the task stack , Then it will Activity Other upper layers Activity Out of the stack , Make this Activity Stack top ; Otherwise create a new Activity example .
  4. SingleInstance: Single instance mode . In this mode , The system will start a new stack to manage the Activity, Different applications can share the Activity.

Activity Jump

  1. Explicit start Intent Directly specify the... To start Activity The corresponding class, Can pass Intent Construction method 、setClasssetClassName Three ways to specify .
  2. Implicitly start Intent Specify matching criteria , from Activity Registered in AndroidManifest.xml In the document intent-filter The nodes match , There are conditions actioncategorydata Three , All or part of the match can be .

1.2 Difficult points

Two Activity The life cycle when jumping

The common scenes are two Activity Jump , Such as A Jump to B, here A and B The life cycle is intertwined , It's not simple A Run all the life cycles and start all over again B Life cycle of .

  1. When B No instance , And it's not transparent or translucent :A.onPause() > B.onCreate() > B.onStart() > B.onResume() > A.onStop().
    At that moment, from B return A:B.onPause() > A.onRestart() > A.onStart() > A.onResume() > B.onStop() > B.onDestroy().
  2. When B No instance , When it is transparent or translucent :A.onPause() > B.onCreate() > B.onStart() > B.onResume().
    At that moment, from B return A:B.onPause() > A.onResume() > B.onStop() > B.onDestroy().

Transparent B Will lead to A By B Do not execute when overriding A.onStop() Method ,B return A I don't do it A.onRestart() > A.onStart() These two methods . The next step is not to consider transparency , The lines .

  1. When B There are examples ,B by SingleTop Pattern , And B Stack top (B Not at the top of the stack is equivalent to no instance , Reference resources 1、2 At two o 'clock ): here A Not at the top of the stack , Its life cycle does not execute ,B No life cycle change , But the system calls B.onNewIntent() Tell me how B Received a new Intent.
  2. When B There are examples ,B by SingleTask Pattern :A.onPause() > B.onRestart() > B.onStart() > B.onNewIntent() > B.onResume()(onNewIntent() And onResume() There is no definite order of precedence , Positions may be swapped )> A.onStop() > The original stack is located in B Above Activity Enter the destruction process .

1.3 Interviews often test

The way Activity Life cycle of / Role of each life cycle ?

Research basis , Must recite the knowledge point . The answer is

onStart() and onResume()/onPause() and onStop() The difference between ?

Is it at the front desk , The difference between being visible to the user .

Activity A Start another Activity B Which methods will be called back ? If Activity B It's completely transparent ? If you start a Dialog Well ?

Refer to this article 《1.2 Difficult points - Two Activity The life cycle when jumping 》, The dialog does not call the lifecycle method .

How to put a Activity Set to window style ?

Just for us Activity Configure the following properties .
android:theme="@android:style/Theme.Dialog"

Talk about onSaveInstanceState() Method ? When will call ?

When Activity This method is called when it is accidentally destroyed and recreated , For example, horizontal and vertical screen switching , Will result in the re creation of Activity,onSaveInstanceState() Method is called on onStop() Before , Used to save the current Activity The state of , When Activity After being recreated , Would call onRestoreInstanceState() To restore Activity The state of ,onRestoreInstanceState() The call for is in onStart() Before .

onSaveInstanceState() What are the scenarios that are executed :

The system doesn't know you press HOME How many other programs to run after , Naturally, I don't know activity Will it be destroyed , So the system will call onSaveInstanceState(), Give users the opportunity to save some non permanent data . The analysis of the following situations follows this principle :

  1. When the user presses HOME Key time
  2. Long press HOME key , When you choose to run another program
  3. When the screen is locked
  4. from activity A Start a new activity when
  5. Screen direction switching

onSaveInstanceState() And onPause() The difference between ?

There is no fixed order of execution .

onSavedinstance() Method trigger time , The typical scenario is to press Home Key or switch Activity, In this way Activity Where it may be destroyed , But press Back Key exit program , This method will not be called , It's good for keeping some non persistent data ( That is, the data that needs to be stored during the running of the program ).

and onPause(), Whether it's possible to destroy or exit the program , Must call , Suitable for keeping persistent data , however Android It does not provide for this method itself Bundle Parameters , So we can choose to make a static variable or provide a SharedPreference As a data carrier .

How to avoid configuration changes / When switching between horizontal and vertical screens Activity The reconstruction ?

Under the manifest file, each activity Sign up with android:configChanges=“XXX”
For example, horizontal and vertical screen switching :android:configChanges=“orientation”

Low priority Activity What to do after the insufficient memory is recovered to the state before destruction ?

  1. Task and Activity Stacks and the corresponding Intent And the data will be saved by the system . When APP When I was cut back to the front desk , The system will recover Task and Activity Stacks and the corresponding Intent And data .Activity Data transfer should be provided by the system intent Mechanism .
  2. Not in Application Class and global singleton classes hold data , It can lead to app Can't recover properly . Run time temporary data should be stored in SharedPreference、 In a temporary file or database .
  3. make the best of onSaveInstanceState() and onRestoreInstanceState() Method , When Activity It is easy to restore after being recreated Activity The state of .

Under the said Activity Four startup modes of ?( Sometimes a practical problem arises to analyze the return stack Activity The situation of )

Refer to this article 《1.1 Basic knowledge - start-up 》,《1.2 Difficult points - Two Activity The life cycle when jumping 》.

Talk about singleTop and singleTask The differences and application scenarios ?onNewIntent() Timing of invocation ?

Refer to this article 《1.1 Basic knowledge - start-up 》,《1.2 Difficult points - Two Activity The life cycle when jumping 》.

Know what Activity Start mode flag bit ?

Intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Appoint singleTask Pattern , And in AndroidManifest.xml It is specified in android:launchMode"singleTask" The effect is the same

Intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
// Appoint singleTop Pattern , And in AndroidManifest.xml It is specified in android:launchMode"singleTop" The effect is the same

Intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// With this sign Activity Startup time , In the same task stack, so it's on top of it Activity They all have to go out , It's usually with singleTask Patterns come together

Intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
// With this sign Activity Not in history Activity In the list , It is equivalent to AndroidManifest.xml It is specified in android:excludeFromRecents="true"
The priority ratio of the tag bit is in AndroidManifest High priority specified in

How to start other applications Activity?

SingleTask and taskAfiinity In combination with .

To talk about Fragment Life cycle of ?

Fragment Life cycle
Fragment And Activity The life cycle of is corresponding to

Activity and Fragment Similarities and differences ?

1、 Start with the basics ---> Life cycle

Activity Yes 7 Life cycles :onCreate(); onStart(); onResume(); onPause(); onStop(); onDestroy(); onRestart();

Fragment Yes 11 Life cycles :onAttach(); onCreate(); onCreateView(); onActivityCreate(); onStart(); onResume(); onPause(); onStop(); onDestroyView(); onDestroy(); onDetach();

therefore Fragment Compare with Activity It will be more flexible , Because there are more lifecycles , There's more you can control .

2、 In terms of flexibility

Activity It's one of the four components , It's the bearer of every page , One is one ,Fragment It depends on the display of Activity, from Fragment You can learn from the life cycle of .

Fragment It's small pieces one by one

(1) Compare with Activity More flexible , Can be in XML Write directly to the file , It can also be in Activity Add dynamically in ;
(2) have access to show()/hide() perhaps replace() At any time Fragment Switch , And there will be no obvious effect when switching , The user experience will be good ;Activity Although you can also switch , however Activity Switching between them will have obvious page turning or other effects , It doesn't feel very good for users when they switch small parts of content

Activity and Fragment The relationship between ?

Fragment It depends on the display of Activity, from Fragment You can learn from the life cycle of .

When will you consider using Fragment?

Similar to the menu bar at the bottom of wechat , And mobile phone and tablet adaptation .

2. Service

2.1 Basic knowledge

Concept

Service Literal translation “ service ”, It is mainly used to process some time-consuming logic in the background , Or perform tasks that need to be run for a long time . When necessary , You can even let the service continue to run when the program exits .

effect

Undertake most of the data processing work , Provide heavy and time-consuming background services for other components , It can monitor the running status of other components .

Life cycle

Service Life cycle score of two cases , according to Service There are different ways to start Unbounded and Bounded Two kinds of , Here's the picture :
Service Life cycle

  1. Unbounded yes Service By startService() The life cycle that the method goes through when it starts ,Service When not active , experience onCreate() > onStartCommand() The process enters the active state , Start again at this time Service Just call onStartCommand() Method .
  2. Bounded yes Service By bindService() The life cycle that the method goes through when it starts ,Service When not in a bound state , experience onCreate() > onBind() The process enters the binding state , Now bind again Service Just call onBind() Method .

start-up

Service There are two ways to start :startService() and bindService().

  1. Use startService() Method start up Service, The caller and Service There is no relationship between , Even if the caller exits ,Service Still running .Service Not automatically destroyed , External calls are required stopService() Method or in Service Internal calls stopSelf() Method , here Service Of onDestroy() Method is called .
  2. Use bindService() Method start up Service, The caller and Service Tied together , Once the caller destroys ,Service It's over , When the caller needs to unbind unBindService() Method .Service When unbound or destroyed by the caller ,Service experience onUnbind() > onDestroy() The process of .

2.2 Difficult points

Service Overtime ANR/ Start the child thread

Usually ANR when , The application executed heavy and time-consuming tasks in the main thread , So we need to give the time-consuming task to the child thread .Service When faced with the need to start a child thread , It is also possible to use multithreading directly , But if Service It must be the case that a child thread is required , It is recommended to use IntentService To complete the task .

IntentService yes Service Subclasses of , It and Service The difference is :

  1. There is a worker thread inside to complete time-consuming operations , Just need to achieve onHandleIntent The method can .
  2. After finishing all the tasks , Will automatically terminate the service .
  3. If you perform multiple tasks at the same time , It will be executed sequentially in the form of a work queue .

IntentService It's ideal for dealing with time-consuming tasks in applications , Of course, if parallel execution is needed, consider thread pool , It is suggested that the time-consuming tasks that can be executed serially in the application should be left to IntentService To complete .

2.3 Interviews often test

To talk about Service Life cycle of ?

Refer to this article 《2.1 Basic knowledge - Life cycle 》.

Service There are two ways to start ? What's the difference ?

Refer to this article 《2.1 Basic knowledge - Life cycle 》,《2.1 Basic knowledge - start-up 》.

One Activty First start One Service after , Again bind What method will be called back when ? At this point, how to do the callback Service Of destory() Method ?

If one Service Started and bound again , Then Service Will always be running in the background . And no matter how ,onCreate It's always called once , Corresponding startService How many calls ,Service Of onStart How many times will it be called . call unbindService Will not stop Service, You have to call stopService or Service Of stopSelf To stop the service .

Service How and Activity communicate ?

  1. Binder:
    adopt Binder The formal implementation of the interface , When Activity binding Service When it's successful Activity Will be in ServiceConnection Class Of onServiceConnected() Callback method to get Service Of onBind() Method return Over here Binder Subclasses of , Then call the method through the object .
  2. Aidl:
    aidl It is more suitable for scenarios where the client and server are not in the same application .
  3. Messenger:
    It refers to a Handler object , In order to others Be able to send messages to it ( Use mMessenger.send(Message msg) Method ). This class allows cross process based Message Communication for ( That is, two processes can pass through Message communicate ), Use on the server Handler Create a Messenger, The client holds this Messenger You can communicate with the server . One Messeger Can't send both ways at the same time , Two can be sent in both directions .
  4. radio broadcast , The concrete logic is the same as 3..

What systems have been used Service?

For example, window management service will be used for window related operations WindowManager, Power management services are used for power related operations PowerManager, There are many other systems management services , Such as notification management services NotifacationManager、 Vibration management services Vibrator、 Battery management services BatteryManager……

Is it possible to be in Service Time consuming operations / Network operating ? What can I do if I have to ?

Service Is running in the main thread , Generally not in Service Time consuming operations . Refer to this article 《2.2 Difficult points - Service Overtime ANR/ Start the child thread 》.

IntentService And Service The difference between (intentservice The advantages of )

  1. There is a worker thread inside to complete time-consuming operations , Just need to achieve onHandleIntent The method can , Other methods provide a default implementation .
  2. After finishing all the tasks , Will automatically terminate the service .
  3. If you perform multiple tasks at the same time , It will be executed sequentially in the form of a work queue .

What is the front desk service ? Different from ordinary service ? How to open a front desk service ?

Front desk services are those that users are supposed to know ( What the user approves of ) And the system is not allowed to kill services when the system memory is insufficient .
The front desk service must provide a notification to the status bar , The system priority of front desk service is higher 、 Not easy to recycle .
Service startup , Create a Notification, Call again setForground() Method .

Do you understand ActivityManagerService, Talk about what it does ?

ActivityManagerService( abbreviation AMS) yes Android The most core services , It is mainly responsible for the startup of four components in the system 、 Switch 、 Scheduling and application process management and scheduling , Its responsibilities are similar to the process management and scheduling module in the operating system .

Activity、Intent、Service What's the relationship ?

Activity and Service All are Android One of the four components .Activity Responsible for the display and interaction of user interface ,Service Responsible for background task processing .Activity and Service You can go through Intent To transfer data .

Service and Activity In the same thread ?

For the same app By default, it is in the same thread , All in main Thread (UI Thread).

How to ensure Service Not to be killed ?

  1. stay AndroidManifest.xml For intent-filter Can pass android:priority = “1000” This property sets the highest priority ,1000 Is the highest value , The lower the number, the lower the priority , It can also be used for broadcasting .
  2. stay onStartCommand It calls startForeground() Method to Service Promote to foreground process level , And then again onDestroy Remember to call stopForeground () Method .
  3. onStartCommand Method , Manual return START_STICKY.
  4. stay onDestroy Method internal broadcast restart service.service +broadcast The way , Is that when service go ondestory When , Send a custom broadcast , When it's broadcast , Restart service.( Third party applications or setting in - application - When forced to stop ,APP And the process was killed ,onDestroy No way in , So there's no guarantee it'll work ) It can be done by double Service Evoke each other , Improve the success rate .
  5. Monitor system broadcast judgment Service state .
    Some broadcasts through the system , such as : Phone restart 、 Interface wake up 、 Application state changes and so on monitor and capture , And then judge our Service Is it still alive .
  6. Application add Persistent attribute .

Service Of onStartCommand Method has several return values ? What do you mean ?

There are four return values , The meaning of different values is as follows :

  1. START_STICKY: If service The process is kill fall , Retain service Is in the start state , But not reserved for delivery intent object . along with After that, the system will try to recreate service, Because the service state is start , So after the service is created, it will call onStartCommand(Intent,int,int) Method . If no startup command is passed to service, So parameters Intent Will be for null.
  2. START_NOT_STICKY:“ Non viscous ”. When using this return value , If it's done onStartCommand after , Service is abnormal kill fall , The system will not automatically restart the service .
  3. START_REDELIVER_INTENT: Retransmission Intent. When using this return value , If it's done onStartCommand after , The service is different often kill fall , The system will restart the service automatically , And will Intent Value of passed in .
  4. START_STICKY_COMPATIBILITY: START_STICKY Compatible versions of , But there is no guarantee that the services will be kill It will restart after .

Service Of onRebind(Intent) When will the method execute ?

stay onUnbind() Method returns true In the case of .

3. BroadcastReceiver

3.1 Basic knowledge

Concept

BroadcastReceiver Literal translation " Broadcast receivers ”, It is mainly used to receive broadcast from system and application . stay Android In the system , Broadcasting is reflected in all aspects , For example, power on broadcast 、 Network status broadcast 、 Battery power, radio, etc .

effect

Broadcast can be used to process messages asynchronously , The effect is similar to Handler, Than Handler What's more powerful is that broadcasting can exchange messages throughout the device , Based on this feature, it can be used to solve the problem of inter process communication .

Life cycle

The broadcast life cycle starts from the call to onReceive() The execution is over , It should be noted that , The life cycle of broadcasting is very short , Need to be in 10 Process in seconds onReceive() All the work in , therefore , Generally, long time-consuming work is not carried out , If there's time-consuming work , It should be through Intent Pass to Service To deal with .

Be careful , Not in onReceive() Open the thread to process the time-consuming task , otherwise , stay 10s after , The thread becomes an empty thread , This leads to the loss of tasks . alike , Do not use bindService To bind Services .

start-up

BroadcastReceiver The start-up process starts with registration :

  1. Static registration : Statically registered BroadcastReceiver Automatically create an instance when the application starts , Automatically destroy when the application is destroyed , Completely controlled by the system , Don't pay too much attention to .
  2. Dynamic registration :BroadcastReceiver Usually in Activity Pass through registerReceiver() Method dynamic registration , It should be in Activity Call before destruction unregisterReceiver() Method to log off .

BroadcastReceiver It will start automatically when the corresponding broadcast is received , After execution onReceive() Automatically end after method , The life cycle is short and effective .

3.2 Difficult points

3.3 Interviews often test

Two forms of registration for broadcasting ? What's the difference ?

There are two ways to register broadcast recipients , They are dynamic program registration and AndroidManifest File for static registration .

Dynamic registration broadcast receiver features are used to register Activity Turn it off , And then the radio is dead . Static registration doesn't have to worry about whether the broadcast receiver is turned off , As long as the device is on , The radio receiver is also on . That is to say, even if app It doesn't start itself , The app Subscribed broadcasts also work on it when triggered .

How to judge the present BroadcastReceiver Is it an orderly broadcast or an unordered broadcast ?

stay BroadcastReceiver Class onReceive() In the method , You can call boolean b=isOrderedBroadcast(); The method is BroadcastReceiver Class , It is used to determine whether our current received broadcast is an orderly broadcast .

4. ContentProvider

4.1 Basic knowledge

Concept

ContentProvider Literal translation “ content provider ”, It is mainly used to share the data of this application for other applications , According to this feature, we can also change ContentProvider For interprocess communication . Application registration that provides data ContentProvider, Data acquisition application creation ContentResolver Get corresponding ContentProvider The data of .

effect

Content Provider Make an application's specified dataset available to other applications . Other applications are available through ContentResolver Class to get or store data from the content provider . Developers don't usually use ContentProvider Class object , Most of it is through ContentResolver Object implementation pair ContentProvider The operation of .

Life cycle

ContentProvider The life cycle of is mainly similar to the database CRUD,ContentResolver It also provides the corresponding method call .

start-up

ContentProvider Not by instance , Usually by Context Of getContentResolver() Methods to get ContentResolver example ,ContentResolver Provided with ContentProvider A consistent approach , It can be done by URI Evoke the corresponding ContentProvider On the data provided CRUD operation .

4.2 Difficult points

4.3 Interviews often test

ContentProvider To understand how much ?

(1)android The platform provides ContentProvider Make an application's specified dataset available to other applications . Other applications are available through ContentResolver Class to get or store data from the content provider .

(2) Content providers are only needed if data needs to be shared across multiple applications . for example , Address book data is used by multiple applications , And must be stored in a content provider . Its advantage is uniform data access .

(3)ContentProvider Implement data sharing .ContentProvider Used to save and retrieve data , And make it visible to all applications . It's the only way to share data between different applications , because android There is no common access for all applications provided by .

(4) Developers don't use ContentProvider Class object , Most of it is through ContentResolver Object implementation pair ContentProvider The operation of .

(5)ContentProvider Use URI To uniquely identify its dataset , there URI With content:// As a prefix , Indicates that the data is from ContentProvider To manage .

Reference article :
Android Interview questions ( Four components )
Android The four components of the interview questions are related to

版权声明
本文为[coder-ice]所创,转载请带上原文链接,感谢

Scroll to Top