1
I’m doing an android course that has navigation in bars and for this is used Ragments, I did the video way however tabs appear but the content of Ragments no, in the console I have this error:
Recyclerview: No Adapter Attached; Skipping layout
my main Activity ta so:
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"/>
Adapter class
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];
}