Cannot call notifyItemInserted() from RecyclerView.OnScrollListener

前端 未结 4 1477
清歌不尽
清歌不尽 2021-01-31 14:52

Recently I upgrade my recyclerview-v7:23 to recyclerview-v7:24.2.0. My applicaton has an endless scroll list. The error message points to the line

4条回答
  •  执笔经年
    2021-01-31 15:07

    You could also use Google Play Service's Tasks API

    Tasks.call(new Callable() {
        @Override
        public Void call() throws Exception {
            allArticles.add(null);
            articleAdapter.notifyItemInserted(allArticles.size() - 1);
            return null;
        }
    });
    

提交回复
热议问题