You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can i use this without pager.i tried to add tabs using addTab method and later tried using addOntabselected Listener but its showing an error.I am using below code to do so. Is there any other way of doing the same thing or is there something wrong with my code ?
navigationTabStrip.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
Toast.makeText(getContext(), tab.getText(), Toast.LENGTH_SHORT).show();
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
its showing an error
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setContentDescription(java.lang.CharSequence)' on a null object reference
at com.google.android.material.tabs.TabLayout$Tab.setText(TabLayout.java:1846)
The text was updated successfully, but these errors were encountered:
How can i use this without pager.i tried to add tabs using addTab method and later tried using addOntabselected Listener but its showing an error.I am using below code to do so. Is there any other way of doing the same thing or is there something wrong with my code ?
with a addontabselectedlistener
its showing an error
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setContentDescription(java.lang.CharSequence)' on a null object reference
at com.google.android.material.tabs.TabLayout$Tab.setText(TabLayout.java:1846)
The text was updated successfully, but these errors were encountered: