API版本15中不推荐使用SimpleCursorAdapter吗?

vog*_*lla 30 android simplecursoradapter

SimpleCursorAdapter使用以下注释弃用其构造函数之一:

已过时.不鼓励使用此选项,因为它会导致在应用程序的UI线程上执行Cursor查询,从而导致响应能力较差甚至应用程序无响应错误.作为替代方案,使用android.app.LoaderManager和android.content.CursorLoader.

这是否会使整个班级弃用?不推荐使用其他(标准)构造函数.

Fra*_*amo 53

不推荐使用构造函数,而不是整个类.

SimpleCursorAdapter (Context context, int layout, Cursor c, String[] from, int[] to)调用SimpleCursorAdapter (Context context, int layout, Cursor c, String[] from, int[] to, int flags)flags设置为FLAG_AUTO_REQUERY.

但是FLAG_AUTO_REQUERY被弃用是因为

[...]它导致在应用程序的UI线程上执行Cursor查询[...]

所以也不推荐使用构造函数.

不推荐使用标准构造函数,但显然,您不必使用flags= 调用它FLAG_AUTO_REQUERY!

最后,如果您正在使用SimpleCursorAdaptera CursorLoader,如文档所示,则不需要此标志,您可以通过0.