Yes. Another middleman!
Content Providers are (seemingly) good abstraction layer between data source and UI. Some advantages of this include data validation.
They enable you to decouple your application layers from the underlying data layers, making your application data-source agnostic by abstracting the underlying data source.
content_authority(usually package name) and content_name(our Java class for Provider) is written in Android Manifest.
content://content_authority/table_name/row_id
Note: row_id should be specified when we want a single row, of course.
Now in Contract class, we should make those constants: String CONTENT_AUTHORITY
, Uri BASE_CONTENT_URI
, String PATH
, and in Entry subclass, Uri CONTENT_URI
; Use Uri's withAppendedPath(Uri baseUri, String path)
to append base URI and path.