right now i m using latest version of appcompat and design support library.
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
now i m facing some deprecation
private void setupTabLayout() {
mTabLayout = (TabLayout)findViewById(R.id.tab_layout);
mAdapter = new MyPagerAdapter(getSupportFragmentManager());
mPager = (ViewPager)findViewById(R.id.pager);
mPager.setAdapter(mAdapter);
mTabLayout.setTabsFromPagerAdapter(mAdapter); <!-- deprecated -->
mTabLayout.setupWithViewPager(mPager);
}
anyone know what i have to use instead.. help me.. thank you
This is from TabLayout documentation on setTabsFromPagerAdapter
:
/**
* @deprecated Use {@link #setupWithViewPager(ViewPager)} to link a TabLayout with a ViewPager
* together. When that method is used, the TabLayout will be automatically updated
* when the {@link PagerAdapter} is changed.
*/
@Deprecated
public void setTabsFromPagerAdapter(@Nullable final PagerAdapter adapter) {
setPagerAdapter(adapter, false);
}
So just like Nikola Despotoski said in comment, calling setupWithViewPager
is enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With