I dont know what’s happen?
How can solve it?
HomeFragment
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.ifunpot_feed, container, false); recyclerView1 = (RecyclerView) view.findViewById(R.id.recy_feed); recyclerView2 = (RecyclerView) view.findViewById(R.id.recy_stories); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity()); recyclerView1.setLayoutManager(layoutManager); RecyclerView.LayoutManager layoutManager1 = new LinearLayoutManager(getActivity()); ((LinearLayoutManager) layoutManager1).setOrientation(LinearLayoutManager.HORIZONTAL); recyclerView2.setLayoutManager(layoutManager1); adapterFeed = new RecyclerViewAdapterFeed(getActivity(), feedModelArrayList); adapterStories = new RecyclerViewAdapterStories(getActivity(), storiesModelArrayList); recyclerView1.setAdapter(adapterFeed); recyclerView2.setAdapter(adapterStories); populaterecyclerview(); populaterecyclerviewstories(); return inflater.inflate(R.layout.fragment_home, container, false); }
The error occurs in recyclerView1.setLayoutManager(layoutManager);
fragment_home.xml
<RelativeLayout android:id="@+id/rel_lay1" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v7.widget.RecyclerView android:id="@+id/recy_stories" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content"> </android.support.v7.widget.RecyclerView> <View android:id="@+id/line_1" android:layout_below="@id/recy_stories" android:layout_width="match_parent" android:layout_height="1dp" android:alpha=".2" android:background="@android:color/black" android:layout_marginTop="10dp"/> </RelativeLayout> <android.support.v7.widget.RecyclerView android:layout_below="@id/rel_lay1" android:id="@+id/recy_feed" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v7.widget.RecyclerView> </RelativeLayout>