Ошибка при компиляции... Кто знает в чем проблема?
public class CurrentTaskFragment extends Fragment {
private RecyclerView rvCurrentTask;
private RecyclerView.LayoutManager layoutManager;
private CurrentTasksAdapter adapter;
public CurrentTaskFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_current_task, container, false);
rvCurrentTask = (RecyclerView)rootView.findViewById(R.id.rvCurrentTasks);
layoutManager = new LinearLayoutManager(getActivity());
rvCurrentTask.setLayoutManager(layoutManager);
adapter = new CurrentTasksAdapter();
rvCurrentTask.setAdapter(adapter);
return rootView;
}
Лог:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: devferrarizero.whattodotasklist, PID: 2621
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
at devferrarizero.whattodotasklist.fragment.DoneTaskFragment.onCreateView(DoneTaskFragment.java:33)