Android ContentProvider用法解惑
PHPz
PHPz 2017-04-17 17:03:14
0
3
690
PHPz
PHPz

学习是最好的投资!

reply all(3)
巴扎黑

Sorry, I’m asking myself again. I have solved this problem at the code level, and the solution is:

  1. If the update, insert, and delete of ContentProvider will affect the display of the UI, then the DB cannot be directly manipulated in the code. Instead, ContentProvider should be used uniformly, and ContentObserver needs to be registered to monitor Uri in order to switch UI.

  2. If the operation of ContentProvider does not affect the UI, then it doesn't matter. It is also possible to directly operate the DB internally.

迷茫

According to the definition of ContentProvider, it is a standard API for data exchange in different applications. It can be used when an application needs to expose data to other applications, and other applications can operate the exposed data through ContentResolver and expose their own through ContentProvider. Data operation interface, other applications can perform corresponding addition, deletion, modification and query operations through this interface. But the essence of the operation through ContentResolver is to call the operation of ContentProvider, and the operation uses the db of SQLiteOpenHelper. So I personally think there is no need to rewrite it, but this is also a personal opinion. You still have to try it yourself and you will know the result.

Peter_Zhu

It should be true. Data written directly through data is application private data and cannot be accessed by other applications. However, if the DB file is operated in the SD card, it seems to be accessible.

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!