Android CONTENT TYPE - vnd.android.cursor.dir is a standard constant defined by android?

I have a major problem understanding content types.

I looked through a lot of examples and text explaining the above term, but still have some basic issues of understanding. Can someone clarify me please.

In the example of notepad android and many others, vnd.android.cursor.dir / is referenced to allow a list of items in a directory and vnd.android.cursor.item / refers to a specific item in a directory.

Is this vnd.android.cursor.dir some standard constant defined by android. Where did it come from ?, or can I change it, how

vn.com.android.myexample.dir /

How is this permitted and what is its purpose, why not use the full CONTENT_URI?

Sorry, I completely lost and do not understand this.

+43
android
Sep 26 '11 at 23:25
source share
2 answers

The MIME types returned by ContentProvider.getType have two distinct parts:

type/subType 

The type part indicates the known type that is returned for the given ContentProvider URI, since request methods can only return Cursors, the type should always be:

  • vnd.android.cursor.dir if you expect the cursor to contain 0 ad infinitum

or

  • vnd.android.cursor.item if you expect the cursor to contain 1 element

Part of subType can be either a well-known subtype or something unique for your application.

Therefore, when using ContentProvider, you can configure the second part of a subtype of the MIME type, but not the first part. for example, a valid MIME type for your ContentProvider applications might be:

 vnd.android.cursor.dir/vnd.myexample.whatever 

The MIME type returned from the ContentProvider can be used with the intent to determine what activity to run to process data received from the given URI.

+69
Sep 27 2018-11-11T00:
source share

Where did it come from ?, or can I change it like vn.com.android.myexample.dir /

No, because "vnd" means the provider in the MIME registry trees, in this case android.

+3
10 Oct '14 at 20:46
source share



All Articles