Pro Android with Kotlin


CHAPTER 6: Content Providers


Download 5.42 Mb.
Pdf ko'rish
bet82/223
Sana04.11.2023
Hajmi5.42 Mb.
#1746807
1   ...   78   79   80   81   82   83   84   85   ...   223
Bog'liq
@de android telegram Pro Android with Kotlin Developing Modern Mobile

88
CHAPTER 6: Content Providers
As an associated entry inside the table RawContacts, you will find among others the 
following:
_id = 1
account_type = com.google
contact_id = 1
display_name_alt = Mayer, Hugo
sort_key_alt = Mayer, Hugo
account_name = pmspaeth1111@gmail.com
display_name = Hugo Mayer
sort_key = Hugo Mayer
times_contacted = 0
account_type_and_data_set = com.google
Obviously, you find many of these entries also inside the Contacts view listed earlier. 
Associated are zero to many entries inside the Data table (with only the most important 
shown).
Entry:
_id = 3
mimetype = vnd.android.cursor.item/phone_v2
raw_contact_id = 1
contact_id = 1
data1 = (012) 345-6789
Entry:
_id = 4
mimetype = vnd.android.cursor.item/phone_v2
raw_contact_id = 1
contact_id = 1
data1 = (098) 765-4321
Entry:
_id = 5
mimetype = vnd.android.cursor.item/email_v2
raw_contact_id = 1
contact_id = 1
data1 = null
Entry:
_id = 6
mimetype = vnd.android.cursor.item/name
raw_contact_id = 1
contact_id = 1
data3 = Mayer
data2 = Hugo
data1 = Hugo Mayer
Entry:
_id = 7
mimetype = vnd.android.cursor.item/nickname
raw_contact_id = 1
contact_id = 1
data1 = null


89
CHAPTER 6: Content Providers
Entry:
_id = 8
mimetype = vnd.android.cursor.item/note
raw_contact_id = 1
contact_id = 1
data1 = null
You can see that the rows inside the Data table correspond to edit fields inside the GUI. You 
see two phone numbers, a first and second name, no nickname, and no e-mail address.
DocumentsContract
This is not a contents contract in the same sense as the other contracts we see here. It 
corresponds to android.provider.DocumentsProvider, which is a subclass of android.
content.ContentProvider. We will be dealing with document providers later in the chapter.
FontsContract
This is a contract that deals with downloadable fonts and does not correspond to content 
providers.
MediaStore
The media store handles metadata for all media-related files on both internal and external 
storage devices. This includes audio files, images, and videos. In addition, it handles files in 
a usage-agnostic manner. That means media and nonmedia files relate to media files. The 
root class android.provider.MediaStore itself does not contain content provider–specific 
assets, but the following inner classes do:

MediaStore.Audio
Audio files. Contains more inner classes for music albums, artists, the 
audio files themselves, genres, and play lists.

MediaStore.Images
Images.

MediaStore.Videos
Videos.

MediaStore.Files
Files in general.
You can investigate any of the media store tables by scanning through the online API 
documentation. For your own experiments, you can start with the tables as a whole by 
watching out for constants EXTERNAL_CONTENT_URI and INTERNAL_CONTENT_URI, or methods 
getContentUri(), and then sending them through the same code we already used earlier.



Download 5.42 Mb.

Do'stlaringiz bilan baham:
1   ...   78   79   80   81   82   83   84   85   ...   223




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