Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between contentResolver and ContentObserver

Tags:

java

android

I am developing an Android application that receives MMS and I read a lot of code. And there is contentResolver and ContentObserver, but I do not get what is the difference between them

Like this statement:

contentResolver.registerContentObserver(Uri.parse("content://mms-sms"), true, mmsObserver);

contentResolver.unregisterContentObserver(mmsObserver);

What is the difference between contentResolver and ContentObserver and what do they have to do with receiving MMS?

like image 215
Maha Avatar asked Oct 08 '22 23:10

Maha


1 Answers

ContentProvider as the name suggests provides you a handle or a reference (generally a cursor)to a data set so that you can work with its data

ContentObserver is used to get notified if the data residing in the data set has changed. So it is used to observe the data source for changes.

like image 144
Akhil Avatar answered Oct 10 '22 12:10

Akhil