在Android的基本问题内容提供商 [英] Content Provider in Android basic questions

查看:106
本文介绍了在Android的基本问题内容提供商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解内容提供商的Andr​​oid。

I am having trouble understanding content providers in Android.

你使用意图调用内容供应商以及管理查询?

Do you use intents to call content providers as well as managed queries?

另外,活动有一个意图过滤器。这样做的目的滤波器具有mime类型属性的元素。 Android的怎么知道这个MIME类型是指哪些内容供应商?结果
在清单的标签只是列出了一个权威,但不是完整的CONTENT_URI。此外,在CONTENT_URI封装类,似乎只包含常量,但没有方法的通常定义,所以我怎么看不到链接到内容提供商类。

Also, an activity has an intent filter. The intent filter has a element which has a mimeType attribute. How does Android know which content provider this mimetype is referring to?
The tag in the manifest just lists an authority but not the full content_uri. Further, the content_uri is typically defined in an encapsulated class that seems to only consist of constants but no methods, so I don't see how that links over to the content provider class.

感谢

推荐答案

我回答了一些问题今天早些时候的 Android的开发者。让我尝试再次在这里。

I answered some of these questions earlier today on android-developers. Let me try it again here.

你使用意图调用内容
  供应商以及管理查询?

Do you use intents to call content providers as well as managed queries?

没有。

如何Android的知道哪些内容
  这提供MIME类型是指
  什么?

How does Android know which content provider this mimetype is referring to?

它要求的ContentProvider ,通过的getType(),提供MIME类型乌里是在意图

It asks the ContentProvider, via getType(), to provide the MIME type for the Uri that is in the Intent.

在清单标签只是列出了
  权威但不完整
  CONTENT_URI。

The tag in the manifest just lists an authority but not the full content_uri.

这就是所有需要为Android找到合适的的ContentProvider 上调用的getType()

That is all that is needed for Android to find the right ContentProvider on which to call getType().

这篇关于在Android的基本问题内容提供商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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