I tried to convert Activity into a Fragment.
Cant seem to correctly pass the context ( marked the corresponding lines). Android Studio show that marked lines seem to be unreachable .
mRecyclerView = getView().findViewById(R.id.recycler_view); // <<<<<
mExampleAdapter = new SearchItemAdapter(SearchFragment.this, mExampleList); //<<<< ( this is from inside a method)
Any help is appriciated !
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_search, container, false);
mRecyclerView = getView().findViewById(R.id.recycler_view); // <<<<<
mRecyclerView.setHasFixedSize(true);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
This is another part inside a method with same problem :
mExampleAdapter = new SearchItemAdapter(SearchFragment.this, mExampleList); //<<<<