Why am I getting a null reference on my RecyclerView

后端 未结 5 807
攒了一身酷
攒了一身酷 2021-02-02 12:37

I am trying to use the RecyclerView in my fragments. It shows up fine for the first tab, but when I swipe to the second tab and then back to the first one I get the following er

5条回答
  •  轮回少年
    2021-02-02 13:24

    Because it has already inflated pref.xml . You should remove this:

        @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        mRootView = inflater.inflate(R.layout.xxx, container, false);
        return mRootView;
    }
    

提交回复
热议问题