3.App Components-Content Providers

來源:互聯網
上載者:User

標籤:des   android   style   io   color   os   ar   for   sp   

1. Content Providers

  A content provider manages access to a central repository of data.

  A provider is part of an Android application, which often provides its own UI for working with the data. However, content providers are primarily

    intended to be used by other applications, which access the provider using a provider client object. Together, providers and provider clients

    offer a consistent, standard interface to data that also handles inter-process communication and secure data access.

 

2. OverView

  2.1 Accessing a provider

    An application accesses the data from a content provider with a ContentResolver client object. This object has methods that call

      identically-named methods in the provider object, an instance of one of the concrete subclasses of ContentProvider. The

      ContentResolver methods provide the basic "CRUD" (create, retrieve, update, and delete) functions of persistent storage.

  2.2 Content URIs

    A content URI is a URI that identifies data in a provider. Content URIs include the symbolic name of the entire provider (its authority)

      and a name that points to a table (a path). When you call a client method to access a table in a provider, the content URI for the

      table is one of the arguments.

3. Retrieving Data from the Provider

  To retrieve data from a provider, follow these basic steps:

    <1> Request the read access permission for the provider.

    <2> Define the code that sends a query to the provider

  3.1 Requesting read access Permission

    To retrieve data from a provider, your application needs "read access permission" for the provider

  3.2 Constructing the query

    

  3.3 Displaying qurey results

  3.4 Getting data from qurey results

 

3.App Components-Content Providers

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.