GetType()

 

The last method you need to implement is . This takes a and returns the MIME type associated with that Uri. The Uri could be a collection or an instance Uri; you need to determine which was provided and return the corresponding MIME type.

For example, here is from :

 

Public getType

If isCollectionUri

Return getCollectionType

 

 

Return getSingleType

 

As you can see, most of the logic delegates to private and methods:

Private getCollectionType

Return

 

 

Private getSingleType

Return

 

Step #2: Supply a Uri

 

You also need to add a public static member… somewhere, containing the for each collection your content provider supports. Typically this is a public static Uri put on the content‑provider class itself:

Public static final

Parse

You may wish to use the same namespace for the content that you use for your Java classes, to reduce the chance of collision with others.

 

Step #3: Declare the Properties

 

Remember those properties you referenced when you were using a content provider in the previous chapter? Well, you need to have those too for your own content provider.

Specifically, you want a public static class implementing that contains your property names, such as this example from :

Public static final class implements

Public static final

Parse








Дата добавления: 2015-05-16; просмотров: 620;


Поиск по сайту:

При помощи поиска вы сможете найти нужную вам информацию.

Поделитесь с друзьями:

Если вам перенёс пользу информационный материал, или помог в учебе – поделитесь этим сайтом с друзьями и знакомыми.
helpiks.org - Хелпикс.Орг - 2014-2024 год. Материал сайта представляется для ознакомительного и учебного использования. | Поддержка
Генерация страницы за: 0.004 сек.