create auto scroll viewpager android code example
Example: automatic slide viewpager android
Handler handler = new Handler();
Runnable timeCounter = new Runnable() {
@Override
public void run() {
if((currentIndex+1)>imageId.length() ){
currentIndex=0;
}else{
currentIndex++;
}
ViewPager.setCurrentItem(currentIndex);
handler.postDelayed(timeCounter, 3*1000);
}
};
handler.postDelayed(timeCounter, 3*1000);