当前位置:网站首页>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
边栏推荐
- Bind threads to run on a specific CPU logical kernel
- ES6 learning path (IV) operator extension
- Talk about the job experience of kotlin cooperation process
- C#访问MongoDB并执行CRUD操作
- Deeply understand the working principle of kotlin collaboration suspend (beginners can also understand it)
- Torchvision loads the weight of RESNET except the full connection layer
- Handwriting sorter component
- [paid promotion] collection of frequently asked questions, FAQ of recommended list
- QT connection to Shentong database
- Interpretation of source code demand:a rotation equivariant detector for aerial object detection
猜你喜欢

Installation, use and explanation of vulnerability scanning tool OpenVAS

Opencv learning notes -day 11 (split() channel separation function and merge() channel merge function)
![[wechat applet] realize applet pull-down refresh and pull-up loading](/img/23/2668a3a36fd46f63732c753fd6f237.jpg)
[wechat applet] realize applet pull-down refresh and pull-up loading

将线程绑定在某个具体的CPU逻辑内核上运行

Detectron2 source code reading 4-- registrar construction model
![[shutter] solve failed assertion: line 5142 POS 12: '_ debugLocked‘: is not true.](/img/77/eb66ec83b34c251e732d495fbaa951.jpg)
[shutter] solve failed assertion: line 5142 POS 12: '_ debugLocked‘: is not true.

Applet learning path 2 - event binding

Metasploit practice - SSH brute force cracking process

技术管理进阶——管理者如何进行梯队设计及建设

Evaluation standard for audio signal quality of intelligent speakers
随机推荐
127.0.0.1, 0.0.0.0 and localhost
Opencv learning notes -day8 (keyboard typing (waitkey()); Wait for typing) action: triggers some action when the appropriate character is typed using the keyboard)
Opencv learning notes -day 12 (ROI region extraction and inrange() function operation)
c#获取当前的时间戳
Deep understanding of continuation principle
Opencv learning notes -day3 (mat object and creation related operations mat:: clone(), mat:: copyto(), mat:: zeros(), mat:: ones(), scalar()...)
[shutter] solve failed assertion: line 5142 POS 12: '_ debugLocked‘: is not true.
Opencv learning notes -day 11 (split() channel separation function and merge() channel merge function)
Comparison of two ways for C to access SQL Server database (SqlDataReader vs SqlDataAdapter)
Esp32 (7): I2S and I2C drivers for function development
Wikimedia Foundation announces the first customers of its new commercial product "Wikimedia enterprise"
Understanding of MVVM and MVC
Talk about the kotlin cooperation process and the difference between job and supervisorjob
Maxiouassigner of mmdet line by line interpretation
Harmonyos actual combat - ten thousand words long article understanding service card development process
Opencv learning notes-day14 drawing of image geometry (rect class rotatedrect class, rectangle drawing rectangle circle drawing circular function line drawing line function ellipse drawing elliptic fu
Is it safe to open an account? How can anyone say that it is not reliable.
Use Huawei performance management service to configure the sampling rate on demand
Understanding society at the age of 14 - reading notes on "happiness at work"
Opencv learning notes-day6-7 (scroll bar operation demonstration is used to adjust image brightness and contrast, and createtrackbar() creates a scroll bar function)