CursorAdapter的什么我都用? [英] What CursorAdapter have I to use?

查看:171
本文介绍了CursorAdapter的什么我都用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CursorAdapter的有3个构造函数。让我们看到了指导和参考。

CursorAdapter have 3 constructors. Let see the guide and reference.

1)的CursorAdapter(上下文的背景下,光标C)

此构造是德precated。的该选项气馁,因为它会导致光标查询正在对应用程序的用户界面进行   线程,从而可能会导致反应不佳,甚至申请不   响应错误。作为替代,可使用LoaderManager用   CursorLoader。

This constructor is deprecated. This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use LoaderManager with a CursorLoader.

2)的CursorAdapter(上下文的背景下,光标C,布尔autoRequery)

构造,允许通过自动重新查询控制。 建议   你不能使用这个的,而是CursorAdapter的(语境下,光标,INT)。

Constructor that allows control over auto-requery. It is recommended you not use this, but instead CursorAdapter(Context, Cursor, int).

3)的CursorAdapter(上下文的背景下,光标C中,int标志)

推荐的构造。

标志的用于确定适配器的行为标志;可以是FLAG_AUTO_REQUERY的任意组合和   FLAG_REGISTER_CONTENT_OBSERVER。

flags Flags used to determine the behavior of the adapter; may be any combination of FLAG_AUTO_REQUERY and FLAG_REGISTER_CONTENT_OBSERVER.

FLAG_AUTO_REQUERY的这个常量是德precated 的。此选项   气馁,因为它会导致光标被查询所执行   应用程序的UI线程,从而可能会导致反应不佳,甚至   应用程序无响应的错误。作为替代方案,使用   LoaderManager与CursorLoader。

FLAG_AUTO_REQUERY This constant is deprecated. This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use LoaderManager with a CursorLoader.

FLAG_REGISTER_CONTENT_OBSERVER。 此标志不使用时,一个需要   CursorAdapter的一个CursorLoader。

FLAG_REGISTER_CONTENT_OBSERVER. This flag is not needed when using a CursorAdapter with a CursorLoader.

的CursorAdapter(语境上下文,光标C,诠释标志)是推荐的构造,但可能的标记有2,一种是pcated德$ P $,并利用具有CursorLoader一个的CursorAdapter当对方是不需要的。如果我使用了CursorLoader我必须使用此构造,并通过零标志一个CursorAdapter的?而在这种情况下构造函数中相同的比#1日precated?

CursorAdapter(Context context, Cursor c, int flags) is the recommended constructor, but the possible flags are 2, one is deprecated and the other is not needed when using a CursorAdapter with a CursorLoader. If I use a CursorAdapter with a CursorLoader I have to use this constructor and pass zero as flag? And in this case is constructor the same than #1 deprecated?

推荐答案

通过使用#1,则默认适配器自动重新查询。这不同于#3,因为你可以指定是否要自动重新查询(你不应该,每个文档)。所以,不,如果你通过了#3构造#1和#3是不一样的0。

By using #1, it defaults the adapter to auto-requery. This differs from #3 because you can specify if you wish to auto-requery (which you shouldn't, per the documentation). So, no, #1 and #3 aren't the same if you pass the #3 constructor 0.

这篇关于CursorAdapter的什么我都用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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