当前位置:网站首页>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
边栏推荐
- Sort (simple description)
- Talk about the job experience of kotlin cooperation process
- Based on svelte3 X desktop UI component library svelte UI
- Use V-IF with V-for
- Opencv learning notes-day6-7 (scroll bar operation demonstration is used to adjust image brightness and contrast, and createtrackbar() creates a scroll bar function)
- Esp32 things (3): overview of the overall system design
- Opencv learning notes -day8 (keyboard typing (waitkey()); Wait for typing) action: triggers some action when the appropriate character is typed using the keyboard)
- Small program learning path 1 - getting to know small programs
- Flutter 0001, environment configuration
- icon资源
猜你喜欢

Duplicate entry '2' for key 'primary appears in JPA‘

C accesses mongodb and performs CRUD operations

Maxiouassigner of mmdet line by line interpretation

Talk about the kotlin cooperation process and the difference between job and supervisorjob

使用华为性能管理服务,按需配置采样率

Baidu map JS browsing terminal

Applet learning path 2 - event binding

Deeply understand the working principle of kotlin collaboration suspend (beginners can also understand it)

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

Flink Exception -- No ExecutorFactory found to execute the application
随机推荐
Get to know handler again
Detectron2 source code reading 2--- using the configurable decorator to build the dataloader
Introduction to the runner of mmcv
Opencv learning notes -day10 logical operation of image pixels (usage of rectangle function and rect function and bit related operation in openCV)
证券开户的优惠怎样才能得到?在线开户安全?
Using appbarlayout to realize secondary ceiling function
[wechat applet] realize applet pull-down refresh and pull-up loading
Flutter 0001, environment configuration
Source code interpretation of detectron2 1--engine
C#访问MongoDB并执行CRUD操作
[cmake] make command cannot be executed normally
Opencv learning notes -day 12 (ROI region extraction and inrange() function operation)
About Lombok's @data annotation
Small program learning path 1 - getting to know small programs
Esp32 (IX): OTA function of function development
Torchvision loads the weight of RESNET except the full connection layer
Detectron2 source code reading 4-- registrar construction model
Based on svelte3 X desktop UI component library svelte UI
Flink Exception -- No ExecutorFactory found to execute the application
Opencv learning notes-day9 opencv's own color table operation (colormap coloraptypes enumeration data types and applycolormap() pseudo color function)