3.App Components-Content Providers

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

时间: 2024-11-29 04:06:24

3.App Components-Content Providers的相关文章

Android Studio中的App Components重要点记述

阅读英文文档而理解的file:///E:/Android2016/sdk/docs/guide/components/fundamentals.html#Components App Compnents 每个component都是系统可以进入你的app的一种方式,但是不是所有的component都是对于user而言的真实的entry points. 共有四种app components: Activity: 每一个activity代表用户界面的一个单独的屏幕,这些activity是相互独立的 S

Android官方文档之Content Providers

Content Providers是Android中四大组件之一,用于管理应用程序访问结构化的数据.Content Providers可以压缩数据(They encapsulate the data),并保护访问数据的安全.Content Providers是应用程序访问跨进程数据的标准接口(standard interface that connects data in one process with code running in another process). 本文将介绍Conten

Android官方文档之App Components(Common Intents)

Intent的真正强大之处在于它的隐式Intent,隐式Intent需要配合Intent-filters使用,有关这方面的概念和知识,您可以参考我翻译的官方文档:<Android官方文档之App Components(Intents and Intent Filters)>. 隐式Intent足够强大,以至于系统提供了大量的Intent方便开发者启动系统应用程序,本文将介绍一些常用的隐式Intent.以及如何自定义intent-filters以匹配隐式intent. 如需阅读官方原文,您可以点

Android官方文档之App Components(Intents and Intent Filters)

Android应用框架鼓励开发者在开发应用时重用组件,本文将阐述如何用组件构建应用程序以及如何用intent将组件联系起来. 如需阅读官方原文,请您点击这个链接: <App Components>. 您还可以参考这些博文: <Using DialogFragments> <Fragments For All> <Multithreading For Performance> 以及这些Training: <Managing the Activity Li

5、二、App Components(应用程序组件):0、概述

二.App Components(应用程序组件) 0.概述 ? App Components Android's application framework lets you create rich and innovative apps using a set of reusable components. This section explains how you can build the components that define the building blocks of your

Android官方文档之App Components(Activities)

Activity是Android四大组件之首,本文将介绍Activity的含义.创建.启动.销毁.生命周期 等. 如需访问官方原文,您可以点击这个链接:<Activities> Activities Activity是一个类,它是Android呈现界面的载体,用于与用户操作交互,如拨号.照相.发送邮件.展示地图 等.每个Activity都承载了一个Window,这个Window用来绘制UI(User Interface).一般情况下,该Window铺满(fill)整个屏幕:有时候,它也可以悬浮

Android官方文档之App Components(Common Intents)(转载)

原文地址:http://blog.csdn.net/vanpersie_9987/article/details/51244558#rd Intent的真正强大之处在于它的隐式Intent,隐式Intent需要配合Intent-filters使用,有关这方面的概念和知识,您可以参考我翻译的官方文档:<Android官方文档之App Components(Intents and Intent Filters)>. 隐式Intent足够强大,以至于系统提供了大量的Intent方便开发者启动系统应用

Content Providers的步骤,来自官网文档

Content Providers In this document Content provider basics Querying a content provider Modifying data in a provider Creating a content provider Content URI summary Key classes ContentProvider ContentResolver Cursor Content providers store and retriev

Android官方文档之App Components(Fragments)

Fragment是Android API中的一个类,它代表Activity中的一部分界面:您可以在一个Activity界面中使用多个Fragment,或者在多个Activity中重用某一个Fragment. 本文将介绍Fragment的定义.创建.添加.移除.生命周期 等,如需访问官方原文,您可以点击这个链接:<Fragments>. Fragments 可以把Fragment想象成Activity中的一个模块,它有自己的生命周期.可以接收输入事件.可以在Activity运行时将Fragmen

Android官方文档之App Components(Loaders)

Loaders在Android 3.0中引入.在Activity和Fragment中,使用Loaders可以方便地加载数据.有关Activity和Fragment的介绍,您可以参考我翻译的官方文档: <Activities> <Fragments> 本文将介绍Loaders API.Loaders的启动.重启.Loaders管理器 等内容,如需访问Loaders的官方原文,您可以点击这个链接:<Loaders>. Loaders Loaders具有如下特性: 它适用于任