radioGroup.setOnCheckedChangeListener(newRadioGroup.OnCheckedChangeListener() {
@Override
public voidonCheckedChanged(RadioGroup group,@IdResintcheckedId) {
intpage =0;
switch(checkedId){
caseR.id.homepage:
page =0;
break;
caseR.id.homepage2:
page =1;
break;
caseR.id.homepage3:
page =2;
break;
}
viewPager.setCurrentItem(page);
}
});
viewPager.setOnPageChangeListener(newViewPager.OnPageChangeListener() {
@Override
public voidonPageScrolled(intposition, floatpositionOffset, intpositionOffsetPixels) {
}
@Override
public voidonPageSelected(intposition) {
switch(position){
case0:
h1.setChecked(true);
break;
case1:
h2.setChecked(true);
break;
case2:
h3.setChecked(true);
break;
}
}
@Override
public voidonPageScrollStateChanged(intstate) {
}
});