Pro Android with Kotlin


CHAPTER 6: Content Providers


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

98
CHAPTER 6: Content Providers
The parentDocumentId is the ID of the directory we want to have listed, and inside 
projection you can specify the columns that should be returned. Use a list of constants 
COLUMN_* from DocumentsContract.Document. Or write null to return all columns. The 
resulting Cursor at a maximum returns the following fields (keys are constants from 
DocumentsContract.Document):

COLUMN_DISPLAY_NAME (string): The display name of a document, used as the 
primary title displayed to a user. Required.

COLUMN_DOCUMENT_ID (string): The unique ID of a document. Required.

COLUMN_FLAGS: Flags for the document. A combination of (constant names 
from DocumentsContract.Document):

FLAG_SUPPORTS_WRITE (writing supported)

FLAG_SUPPORTS_DELETE (deleting supported)

FLAG_SUPPORTS_THUMBNAIL (representation as thumbnail supported)

FLAG_DIR_PREFERS_GRID (for directories, if they should be shown as a grid)

FLAG_DIR_PREFERS_LAST_MODIFIED (for directories, sorting by
“last modified” preferred)

FLAG_VIRTUAL_DOCUMENT (a virtual document without MIME type)

FLAG_SUPPORTS_COPY (copying supported)

FLAG_SUPPORTS_MOVE (moving, inside the tree, supported)

FLAG_SUPPORTS_REMOVE (removing from the hierarchical structure, not 
deleting, supported)

COLUMN_ICON (int) : A specific icon resource ID for a document. May be null to 
use the system default.

COLUMN_LAST_MODIFIED (long): The timestamp when a document was last 
modified, in milliseconds since January 1, 1970 00:00:00.0 UTC. Required, 
but may be null if undefined.

COLUMN_MIME_TYPE (string): The MIME type of a document. Required.

COLUMN_SIZE (long): Size of a document, in bytes, or null if unknown. 
Required.

COLUMN_SUMMARY (string): The summary of a document; may be shown to a 
user. Optional and may be null.
For network-related operations, you might return data partly and set DocumentsContract.
EXTRA_LOADING on the Cursor to indicate you are still fetching additional data. Then, 
when the network data is available, you can send a change notification to trigger a 
requery and return the complete contents. To support change notifications, you must 
fire Cursor.setNotificationUri() with a relevant URI, maybe from DocumentsContract.
buildChildDocumentsUri(). Then you can call ContentResolver.notifyChange() with that 
URI to send change notifications.



Download 5.42 Mb.

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




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