小编Sea*_*Lab的帖子

在RecyclerView中显示多个数据时出现java.lang.IndexOutOfBoundsException

我将 3 部分数据显示在其中RecyclerView

  1. storyList
  2. yukulList
  3. homeList

当我尝试仅显示storyList或中yukulListhomeList数据时RecyclerView,它有效。但是当我尝试显示多个数据时,例如:storyList && yukulListor storyList && yukulList && homeList,它会显示

java.lang.IndexOutOfBoundsException

我尝试过添加notifyDataSetChanged(),但无法成功。

显示收藏夹列表.java

public class ShowFavouriteList extends AppCompatActivity implements AdapterFavList.FavListener {

    private RecyclerView recyclerView;
    private TextView noFavtsTV;
    AppPreferences appPreferences;
    private SearchView searchView;
    private AdapterFavList yAdapterFavlist;
    private AdapterFavList mAdapterFavlist;
    private AdapterFavList tAdapterFavlist;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_favourite_list);

        SwipeRefreshLayout pullToRefresh = findViewById(R.id.pullToRefresh);
        pullToRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() …
Run Code Online (Sandbox Code Playgroud)

java android android-recyclerview

5
推荐指数
1
解决办法
1401
查看次数

标签 统计

android ×1

android-recyclerview ×1

java ×1