I'm doing an android course that has navigation in bars and for that is used fragments, I did the way the video however the tabs appear but the content of the fragments does not, in the console I have this error:
RecyclerView: No adapter attached; skipping layout
My main activity looks like this:
viewPager = (ViewPager) findViewById(R.id.vp_pagina);
//configurar adaptador
TabAdapter tabAdapter = new TabAdapter(getSupportFragmentManager());
viewPager.setAdapter(tabAdapter);
slidingTabLayout.setViewPager(viewPager);
//xml
<android.support.v4.view.ViewPager android:id="@+id/vp_pagina"
android:layout_width="match_parent" android:layout_height="0dp"
android:layout_weight="1"/>
Class adapter
public TabAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
Fragment fragment = null;
switch (position){
case 0:
fragment = new ConversasFragment();
break;
case 1:
fragment = new ContatosFragment();
break;
}
return fragment;
}
@Override
public int getCount() {
return tituloAbas.length;
}
@Override
public CharSequence getPageTitle(int position) {
return tituloAbas[position];
}