“内容提供者"之间的确切区别和“SQLite 数据库" [英] Exact Difference between "Content-Provider" and "SQLite Database"

查看:31
本文介绍了“内容提供者"之间的确切区别和“SQLite 数据库"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为 Android 完成了 SQLite 数据库编程,但我对内容提供者除此之外:正如我所提到的 Android 开发者页面 ,Android SDK 解释了Content-provider",因为它用于存储和检索数据."

i have done SQLite database programming for Android, but i dont know anything about Content-Provider except this: "As i have referred Android Developer page , Android SDK explained about "Content-provider" as it is used to store and retrieve data."

但是,

  1. 内容提供者"和SQLite 数据库"之间的确切区别是什么?
  2. 什么时候最好存储数据?

任何例子或帮助!!

推荐答案

我发现了一个主要区别,如下:

I found one major difference, as follows:

将数据存储在数据库中是保存数据的一种好方法,但在 Android 中有一个警告——在 Android 中创建的数据库可见 仅适用于创建它们的应用程序.也就是说,一个应用在 Android 上创建的 SQLite 数据库只能被该应用使用,而不能被其他应用使用.

Storing your data in a database is one good way to persist your data, but there's a caveat in Android-databases created in Android are visible only to the application that created them. That is to say, a SQLite database created on Android by one application is usable only by that application, not by other applications.

因此,如果您需要在应用程序之间共享数据,则需要使用 Android 中推荐的内容提供者模型.本文介绍了内容提供者和如何实施.

So, if you need to share data between applications, you need to use the content provider model as recommended in Android. This article presents the basics of content providers and how you can implement one.

我在此链接

提供了非常好的信息.

这篇关于“内容提供者"之间的确切区别和“SQLite 数据库"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆