GetType (Uri UiR) in Android ContentProvider

Source: Internet
Author: User

Public String GetType (URI) used to return the MIME type of data in the specified Uri
* If the manipulated data belongs to the collection type, then the MIME type string should start with vnd.android.cursor.dir/.
For example: To get the URI for all person Records is Content://contacts/person, the MIME type string returned is "Vnd.android.cursor.dir/person".
* If the data to be manipulated belongs to non-collection type data, then the MIME type string should start with vnd.android.cursor.item/.
For example: To get the URI for the person record with ID 10 as CONTENT://CONTACTS/PERSON/10, the MIME type string returned should be "Vnd.android.cursor.item/person"

   @Override    public  String getType (Uri uri) {        newnull  Null);         if (Textutils.isempty (Args.where)) {            return "vnd.android.cursor.dir/" + args.table;         Else  {            return "vnd.android.cursor.item/" + args.table;        }    } 

GetType (Uri UiR) in Android ContentProvider

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.