SimpleCursorAdapter德precated在API版本15? [英] SimpleCursorAdapter deprecated in API version 15?

查看:162
本文介绍了SimpleCursorAdapter德precated在API版本15?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SimpleCursorAdapter 德precates其构造与下面的注释之一:

SimpleCursorAdapter deprecates one of its constructors with the following comment:

pcated德$ P $。此选项气馁,因为它会导致应用程序的UI线程正在执行光标查询,从而可能会导致反应不佳,甚至应用程序无响应的错误。作为替代,可使用android.app.LoaderManager用android.content.CursorLoader

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 android.app.LoaderManager with a android.content.CursorLoader.

这是否pcated全班去$ P $?其他(标准)构造函数并没有去precated。

Does this make the whole class deprecated? The other (standard) constructor is not deprecated.

推荐答案

只有构造德precated,而不是整个类。

Only the constructor is deprecated, not the whole class.

<一个href="http://developer.android.com/reference/android/widget/SimpleCursorAdapter.html#SimpleCursorAdapter%28android.content.Context,%20int,%20android.database.Cursor,%20java.lang.String%5B%5D,%20int%5B%5D%29"><$c$c>SimpleCursorAdapter (上下文的背景下,INT布局,光标C,的String []从,INT []到) 调用<一href="http://developer.android.com/reference/android/widget/SimpleCursorAdapter.html#SimpleCursorAdapter%28android.content.Context,%20int,%20android.database.Cursor,%20java.lang.String%5B%5D,%20int%5B%5D,%20int%29"><$c$c>SimpleCursorAdapter (上下文的背景下,INT布局,光标C,的String []从,INT []键,诠释标志) 与标志集到<一个href="http://developer.android.com/reference/android/widget/CursorAdapter.html#FLAG_AUTO_REQUERY"><$c$c>FLAG_AUTO_REQUERY.

SimpleCursorAdapter (Context context, int layout, Cursor c, String[] from, int[] to) calls SimpleCursorAdapter (Context context, int layout, Cursor c, String[] from, int[] to, int flags) with flags set to FLAG_AUTO_REQUERY.

FLAG_AUTO_REQUERY 是德precated因为

But FLAG_AUTO_REQUERY is deprecated because

[...]它会导致光标查询请求正在对应用程序的用户界面进行   螺纹[...]

[...] it results in Cursor queries being performed on the application's UI thread [...]

所以也构造函数是pcated德$ P $。

so also the constructor is deprecated.

标准的构造并不pcated德$ P $不过,很明显,你不必与标志 = FLAG_AUTO_REQUERY

The standard constructor is not deprecated but, obviously, you don't have to call it with flags = FLAG_AUTO_REQUERY!

最后,如果您使用的是 SimpleCursorAdapter CursorLoader ,如文档建议, 这个标志是没有必要,你可以通过 0

Finally, if you are using SimpleCursorAdapter with a CursorLoader, as the documentation suggests, this flag is not needed and you can pass 0.

这篇关于SimpleCursorAdapter德precated在API版本15?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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