Android realm在一个线程中插入数据,在另外一个线程中有时查到有时查不到数据
PHP中文网
PHP中文网 2017-04-17 17:30:43
0
2
657

我在ui线程中存储数据,在子线程中用,为什么有时候查询到,有时候查询不到数据?

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
小葫芦

The writing operation of Realm is asynchronous(?)... Then bind a Listener to the Result queried by the sub-thread to check whether it has been updated.

阿神

1. First of all, the IO operations involved should not be executed on the UI thread. 2. During asynchronous operations, there is no guarantee that the writing operation has been completed when reading. 3. The poster’s scenario is sequential. After the writing is successful, query again.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!