NullPointerException - Attempt to invoke virtual method RecyclerView$ViewHolder.shouldIgnore()' on a null object reference

后端 未结 6 1955
谎友^
谎友^ 2020-12-06 00:00

Several developers have reported seeing the following stack trace since upgrading to Android Support 23.2.0:

java.lang.NullPointerException: Attempt to invok         


        
6条回答
  •  感动是毒
    2020-12-06 00:33

    I also encountered into this issue, even with version of RecyclerView 27.1.1. And I had the following code in my project:

        recyclerView.setLayoutManager(mLayoutManager);
        SimpleItemAnimator itemAnimator = new DefaultItemAnimator();
        itemAnimator.setSupportsChangeAnimations(false);
        recyclerView.setItemAnimator(itemAnimator);
        LayoutInflater inflater = LayoutInflater.from(getContext());
    

    And I've fixed it after removing addition of Animator to RecyclerView, i.e. this code started to look the following way:

        recyclerView.setLayoutManager(mLayoutManager);
        LayoutInflater inflater = LayoutInflater.from(getContext());
    

提交回复
热议问题