tabs with date as title

93 Views Asked by At

I need tab layouts with the titles as dates in it. In my pager adapter I'm using the following code.

private static final int[] TAB_TITLES = new int[]{R.string.home_tab1, R.string.home_tab2, R.string.home_tab3};

It is working correctly. How can I pass a date with weekdays in integer acceptable parameters. Help me

1

There are 1 best solutions below

2
Prateek Kumar On BEST ANSWER

U can pass an array of string to your CustomPagerAdapter and override getPageTitle inside ur adapter.

public class CustomPagerAdapter extends PagerAdapter {

private List<String> titleArray;

public CustomPagerAdapter(List<String> titleArray) {
    this.titleAray = titleArray;

@Override
public CharSequence getPageTitle(int position) {
    return titleArray.get(position);
  }
}