Pro Android with Kotlin


CHAPTER 6: Content Providers


Download 5.42 Mb.
Pdf ko'rish
bet89/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   85   86   87   88   89   90   91   92   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile

97
CHAPTER 6: Content Providers

FLAG_SUPPORTS_RECENTS (root can be queried to show recently changed 
documents)

FLAG_SUPPORTS_SEARCH (the tree allows for searching documents)

COLUMN_ICON (int): Icon resource ID for a root. Required.

COLUMN_MIME_TYPES (string): Supported MIME types. If more than one, use a 
newline \n as a separator. Optional, and may be null to indicate support for 
all MIME types.

COLUMN_ROOT_ID (string): A unique ID of the root. Required.

COLUMN_SUMMARY (string): Summary for this root; might be shown to a user. 
Optional, and may be null to indicate “unknown.”

COLUMN_TITLE (string): Title for the root, might be shown to a user. Required.
If this set of roots changes, you must call ContentResolver.notifyChange with 
DocumentsContract.buildRootsUri to notify the system.

override fun queryChildDocuments(parentDocumentId: String?, 
projection: Array?, sortOrder: String?): Cursor:
Return the immediate children documents and subdirectories contained in the requested 
directory. Apps targeting at API level 26 or higher should instead implement fun queryChil
dDocuments(parentDocumentId: String?, projection: Array?, queryArgs: 
Bundle?): Cursor and in this method use the following:
override fun queryChildDocuments(
parentDocumentId: String?,
projection: Array?,
sortOrder: String?): Cursor {
val bndl = Bundle()
bndl.putString(
ContentResolver.QUERY_ARG_SQL_SORT_ORDER,
sortOrder)
return queryChildDocuments(
parentDocumentId, projection, bndl)
}

override fun queryChildDocuments(parentDocumentId: String?, 
projection: Array?, queryArgs: Bundle?): Cursor:
Return the immediate children documents and subdirectories contained in the requested 
directory. The bundle argument contains query parameters as keys.
ContentResolver.QUERY_ARG_SQL_SELECTION
ContentResolver.QUERY_ARG_SQL_SELECTION_ARGS
ContentResolver.QUERY_ARG_SQL_SORT_ORDER -or-
ContentResolver.QUERY_ARG_SORT_COLUMNS
(this being a String array)



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   85   86   87   88   89   90   91   92   ...   223




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling