首页 > 代码库 > SimpleCursorAdapter(Context, int, Cursor, String[], int[]) is deprecated???
SimpleCursorAdapter(Context, int, Cursor, String[], int[]) is deprecated???
ListAdapter bookAdapter = new SimpleCursorAdapter(this,R.layout.booklist,cursor,from,to);
提示:The constructor SimpleCursorAdapter(Context, int, Cursor, String[], int[]) is deprecated
API 16给出的解析:
@Deprecatedpublic SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to)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.Constructor the enables auto-requery.
public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags)
Standard constructor.
- Parameters:
context
- The context where the ListView associated with this SimpleListItemFactory is runninglayout
- resource identifier of a layout file that defines the views for this list item. The layout file should include at least those named views defined in "to"c
- The database cursor. Can be null if the cursor is not available yet.from
- A list of column names representing the data to bind to the UI. Can be null if the cursor is not available yet.to
- The views that should display column in the "from" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the from parameter. Can be null if the cursor is not available yet.flags
- Flags used to determine the behavior of the adapter, as perCursorAdapter.CursorAdapter(Context, Cursor, int)
.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。