How can display recycler view using fragment in android

前端 未结 2 531
野趣味
野趣味 2021-01-29 14:22

I want to display recycler view inside fragment but i am getting java.lang.NullPointerException: Attempt to invoke virtual method \'boolean android.support.v7.widget.Rec

相关标签:
2条回答
  • 2021-01-29 14:44

    Try using:

    final LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity());
    

    I think your context is not passed in constructing linearlayoutmanager

    0 讨论(0)
  • 2021-01-29 14:54

    You are creating a view (in the first line) and you are ignoring it and returning something else.

    You should do this :

    return(rootview)
    
    0 讨论(0)
提交回复
热议问题