Android contact Storage Structure

Source: Internet
Author: User

The Database Design of Android 2.x and 1.x contacts is very different. When developing contacts, you must first determine the system version.

Boolean mandroid2 = Android. OS. Build. version. Release. startswith ("2 .");

This article describes some of the development processes and applies to Versions later than 2.x.

Overall.

The main data of a contact is stored in raw_contacts and data tables, which form a master-slave table relationship.

Raw_contacts table structure:

Data Table Structure:

Each contact has a record in raw_contacts, such as the address, name, email, and phone number. data is stored in data, which is easy to expand, for example, to add a contact's email address, you only need to add a record in data.

The contact database is complex. In the development of contact-related applications, it is generally not directly operated by database fields. It is mainly operated by views (specified URIs.

The following describes the data of some contacts I have used in development.


Name:

Uri: URI. parse ("content: // com. Android. Contacts/Data ")

Prefix = "data4"; // name prefix
Mid_name = "data5"; // intermediate name
Given_name = "data2"; // name
Family_name = "data3"; // last name
Mid_pinyin = "data8"; // pinyin
String family_name_pinyin = "data9"; // pinyin
String sufix = "data6"; // name suffix
String sufix_pinyin = "data7"; // name: pinyin


Tel:

Uri: URI. parse ("content: // com. Android. Contacts/data/phones"

Phone: "data1"; // number

Type: "data2"; // This field is an integer that indicates the phone type.

The Type ing is as follows:

Type_custom = 0;
Type_home = 1;
Type_mobile = 2;
Type_work = 3;
Type_fax_work = 4;
Type_fax_home = 5;
Type_pager = 6;
Type_other = 7;

 

Email:

Uri: URI. parse ("content: // com. Android. Contacts/data/emails ")

Email: "data1"; // email address

Type: "data2"; // This field is an integer that indicates the email type.

The Type ing is as follows:

Type_custom = 0;
Type_home = 1;
Type_work = 2;
Type_other = 3;
Type_mobile = 4;

 

Address:

Uri: URI. parse ("content: // com. Android. Contacts/data/postals ")

Street = "data4"; // Street
City = "data8"; // City
State = "data7"; // state
Zip_code = "data9"; // zip code

Type: "data2"; // type:

Type_custom = 0;
Type_home = 1;
Type_work = 2;
Type_other = 3;

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.