ошибка logcat: адаптер не подключен; пропуская макет
Я изменил аргумент context с помощью метода getActivity(), но приложение все еще не работает.
public class FragmentActivity extends Fragment {
private RecyclerView mRecyclerView;
private CountryAdapter mAdapter;
private LinearLayoutManager layoutManager;
public FragmentActivity(){}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.activity_main, container, false);
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.list);
layoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(mAdapter);
mAdapter = new CountryAdapter(CountryManager.getInstance().getCountries(), R.layout.card_layout, getActivity());
return rootView;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
}