im trying to customize this page indicator with half succes, but after many hours im stuck and i dont know whats the problem.
So i want to change the titles for fix day names, from monday to friday, without weekends, and the start position is the current day.
Currently the names are okay,but when i start the app, the current position is friday and the next is saturday, when i swipe, the titles change back to normal, mon to fry.
So the problem is the start position.
Here is the code for the titles.
public String getTitle(int pos){
Calendar cal = Calendar.getInstance();
cal.set(Calendar.DAY_OF_WEEK, 2);
cal.add(Calendar.DAY_OF_WEEK, pos);
return readableDateFormat.format(cal.getTime());
}
And for the position i used this.
static int day = calendar.get(Calendar.DAY_OF_WEEK);
if(day==0 || day==7)
mViewPager.setCurrentItem(1);
else mViewPager.setCurrentItem(day);
Before i changed the titles the positioning worked well.
So if anyone know what i did wrong please help.
i just found the problem, it was my fault, i thought monday ‘s number is 1. the solution is:
if(day==7 || day==8){ mViewPager.setCurrentItem(0); } else { mViewPager.setCurrentItem(day-2); }