(android)解剖contentProvider-001

來源:互聯網
上載者:User

標籤:

本文將介紹如何去研究android的四大組件之一contentProvider,由於我暫時會用到contacts和calendars,就介紹這2個內容先.

轉載請表明來自於http://my.oschina.net/moziqi/blog

首先我介紹我用的工具先,不如會讓讀者迷惑.

我用的是eclipse+genymotion+sqlite Expert Persional,另外我基於android4.0(14版本來弄的,舊版本我不會介紹,你們可以參考我這個來學低版本),我啟動的模擬器是4.4.4,但我教會用4.0的文檔來說,差異應該不會好大

首先當然要啟動相應的軟體吧,如果沒有相應的軟體,可以自己去下載,尤其genymotion這個軟體,需要註冊才可以使用,

配置上面的東西後,在eclipse啟動genymotion,開啟eclipse視圖File Explorer就會顯示如所示:

展開顯示開啟到data->data->com.android.provider.contacts,暫時介紹這個先

把contacts.db匯出到外面,點中contacts.db按按鈕,就可以匯出,看如何匯出

把contacts.db匯入到sqlite Export Persional中就會顯示出來好多張表,如所示

由於這個些表是android內建的,我們看完到這裡之後,就有必要瞭解下什麼叫contentProvider,另外我們也有必要去瞭解這裡面的表欄位有那些,是為了開發做鋪墊.另外不僅僅是表,還有幾個視圖

在說表的欄位前面,我們來介紹下Contacts Provider(連絡人提供者)

(引用官網的文章)

能翻牆,看英文的童靴就最好自己去看下,不太懂英文,就看寫國內的文章,加深對這些概念的理解吧.

The Contacts Provider is a powerful and flexible Android component that manages the device‘s central repository of data about people.

這Contacts Provider 是一個很強大和靈活的Android組件.操控連絡人

Contacts Provider Organization(結構圖)

主要是有3張表

The three tables are commonly referred to by the names of their contract classes. The classes define constants for content URIs, column names, and column values used by the tables:

ContactsContract.Contacts table

Rows representing different people, based on aggregations of raw contact rows.

ContactsContract.RawContacts table

Rows containing a summary of a person‘s data, specific to a user account and type.

ContactsContract.Data table

Rows containing the details for raw contact, such as email addresses or phone numbers.

The other tables represented by contract classes in ContactsContract are auxiliary tables that the Contacts Provider uses to manage its operations or support specific functions in the device‘s contacts or telephony applications.

raw可以翻譯成源(表示來Google/百度),就是來自那裡的連絡人意思吧.

2015-1-2

開啟源碼路徑,自己去下載,別問我怎麼下載

D:\adt-bundle-windows-x86-20140321\sdk\sources\android-19\android\provider

看下自己想看的源碼類

算了,不想磨磨擦,你們自己剩下自己去自學去吧.

看懂這邊文章http://blog.csdn.net/qingye_love/article/details/9028503



(android)解剖contentProvider-001

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.