当前位置:网站首页>Differences between the notify(), notifyall(), notifydatasetchanged(), notifydatasetinvalidated() methods in the adapter
Differences between the notify(), notifyall(), notifydatasetchanged(), notifydatasetinvalidated() methods in the adapter
2022-06-30 09:17:00 【An old dog ˉ】
1.notify() And notifyAll()
notify() and notifyAll() It is generally used to wake up the locked or waiting adapter, Both are object Object is used to notify the thread method waiting for the object .notify Wake up a thread waiting for the object ,notifyAll Wake up all threads waiting for the object . The biggest difference between the two is ,notifyAll Make all that were originally waiting on the object be deleted notify All threads of exit wait state , Become waiting for the lock on the object , Once the object is unlocked , They will compete .notify Just choose one wait Status thread notification , And make it acquire the lock of the thread , Do not disturb other threads that are also waiting for this thread notify The thread of , When the first thread finishes running , Release the lock on the object , At this time, if the object is not used again notify, Even if the object is idle , other wait The thread waiting for status did not receive the notification of this object , Will continue to be wait state , Until this object is emitted again notify perhaps notifyAll. What they are waiting for is to be notify perhaps notifyAll, Not waiting for a lock .
2.notifyDataSetInvalid() And notifyDataSetChanged()
notifyDataSetChanged() and notifyDataSetInvalid() Generally in adapter Called when the data changes .notifyDataSetChanged Force control through an external method , If adapter When the content of , You need to force a call to geiView() Method update item The content in , This method internally implements each event called on the observer , Whenever a change is found in the data set or a new state of the data is read , This method will be called .notifyDataSetInvalid Method internally implements the call on each observer onInvalidated event , Whenever the dataset is found to have changed , For example, the data is no longer valid , Call this method .( notes :notifyDataSetInvalid Will redraw the control and restore it to its original state ,notifyDataSetChanged Redraws the currently visible area .)
If you have any questions, please chat privately or send an email ([email protected]) Discuss together
边栏推荐
- Treatment process record of Union Medical College Hospital (Dongdan hospital area)
- Opencv learning notes -day1 (image reading display imread, imshow, namedwindow)
- Opencv learning notes -day2 (implemented by the color space conversion function cvtcolar(), and imwrite image saving function imwrite())
- 4. use ibinder interface flexibly for short-range communication
- Generate directory in markdown
- Rew acoustic test (IV): test principle of rew
- 快应用中实现自定义抽屉组件
- [paid promotion] collection of frequently asked questions, FAQ of recommended list
- ES6 learning path (II) let & const
- Script summary
猜你喜欢
Interviewer: do you understand the principle of recyclerview layout animation?
Detectron2 source code reading 3-- encapsulating dataset with mapper
C accesses mongodb and performs CRUD operations
Talk about the kotlin cooperation process and the difference between job and supervisorjob
Wikimedia Foundation announces the first customers of its new commercial product "Wikimedia enterprise"
Baidu map JS browsing terminal
8.8 heap insertion and deletion
So the toolbar can still be used like this? The toolbar uses the most complete parsing. Netizen: finally, you don't have to always customize the title bar!
100 lines of code and a voice conversation assistant
Evaluation standard for audio signal quality of intelligent speakers
随机推荐
QT downloading files through URL
Couldn't load this key (openssh ssh-2 private key (old PEM format))
Use Huawei performance management service to configure the sampling rate on demand
Why must redis exist in distributed systems?
What kind of experience is it to develop a "grandson" who will call himself "Grandpa"?
Deep Learning with Pytorch- neural network
5. Messager framework and imessager interface
Interviewer: do you understand the principle of recyclerview layout animation?
Concatapter tutorial
Unsupportedclassversionerror is reported when starting jar package. How to repair it
Tutorial for beginners of small programs day01
RPC understanding
Rew acoustic test (I): microphone calibration
Splice and slice functions of JS
Deep understanding of continuation principle
Opencv learning notes-day5 (arithmetic operation of image pixels, add() addition function, subtract() subtraction function, divide() division function, multiply() multiplication function
Dart asynchronous task
Anchorgenerator for mmdet line by line interpretation
Flink Exception -- No ExecutorFactory found to execute the application
Evaluation standard for audio signal quality of intelligent speakers