Open Rudra-n-khatri opened 5 years ago
If you want to use it without viewpager then use it like this way
dachshundTabLayout.addTab(dachshundTabLayout.newTab().setText("Tab 1"));
dachshundTabLayout.addTab(dachshundTabLayout.newTab().setText("Tab 2"));
dachshundTabLayout.addTab(dachshundTabLayout.newTab().setText("Tab2"));
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)