Android - Crash when clicking on RecyclerView when SwipeRefreshLayout loading

大兔子大兔子 提交于 2019-12-01 11:37:23

From what i understand by your question and log is basically you are clearing the arraylist in onRefresh() but not notifying the adapter that the list has been cleared.

Please call notifyDataSetChanged() after clearing arraylist

Seems like you have cleared your list upon refresh, but the items are still in your recyclerview. You should notify your adapter that the list is empty now. In your current situation, starting to scroll will probably cause the application to crash as well?!

you should put condition for check the size of (for eg. array, ArrayList ... used by you ) data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!