SimpleCursorAdapter的构造函数被声明为废除,不能用了吗?那该用什么代替呢

jiayangcg 2013-06-21 01:27:08
new一个SimpleCursorAdapter时,eclips给出了如下的警告:The constructor SimpleCursorAdapter(Context, int, Cursor, String[], int[]) is deprecated. 同时代码上被画上了删除线,显示此接口被废除了。那该用什么代替呢?
...全文
1109 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
u010236975 2014-10-07
  • 打赏
  • 举报
回复
引用 4 楼 jiayangcg 的回复:
这种问题本应该通过看文档就可以解决的,以后要注意了!
楼主,能给解释一下simplecursoradapter的构造法中 int flags应该填什么吗? 这类文档能在哪里找到? 谢谢!
jiayangcg 2013-06-24
  • 打赏
  • 举报
回复
这种问题本应该通过看文档就可以解决的,以后要注意了!
飞上云端123 2013-06-21
  • 打赏
  • 举报
回复
楼上分析的很到位。
凉凉二点凉 2013-06-21
  • 打赏
  • 举报
回复
多了这个flags
凉凉二点凉 2013-06-21
  • 打赏
  • 举报
回复

    /**
     * Standard constructor.
     * 
     * @param context The context where the ListView associated with this
     *            SimpleListItemFactory is running
     * @param 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"
     * @param c The database cursor.  Can be null if the cursor is not available yet.
     * @param from A list of column names representing the data to bind to the UI.  Can be null 
     *            if the cursor is not available yet.
     * @param 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.
     * @param flags Flags used to determine the behavior of the adapter,
     * as per {@link CursorAdapter#CursorAdapter(Context, Cursor, int)}.
     */
    public SimpleCursorAdapter(Context context, int layout, Cursor c, String[] from,
            int[] to, int flags) {
        super(context, layout, c, flags);
        mTo = to;
        mOriginalFrom = from;
        findColumns(c, from);
    }

80,337

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧