zoukankan      html  css  js  c++  java
  • 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给出的解析:
    @Deprecated
    public 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 running
    layout - 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 per CursorAdapter.CursorAdapter(Context, Cursor, int).
  • 相关阅读:
    【声纹识别】 kaldi callhome diarization
    python3 类型提示
    公钥私钥,HTTPS,HTTP通俗讲解
    一图学会MySQL的JOIN
    链表翻转(看图学)
    如何理解 Python 的赋值逻辑
    Python十大排序算法
    Python-functools (reduce,偏函数partial,lru_cache)
    Python-类型注解(3.5引入)
    Python-装饰器
  • 原文地址:https://www.cnblogs.com/lyyh-victory/p/3791743.html
Copyright © 2011-2022 走看看