I write a ViewPager with some Fragments. In the Fragment, there are VideoView. At the beginning, the first VideoView will auto play, when the first VideoView finishes, I want change the page of VideoView, so I want call setCurrentItem in Fragment. Is this possible?
you can use eventbus notice viewpager to next page. implement toNextPage func
void toNextPage() {
if (viewPager.getAdapter().getCount() >= viewPager.getCurrentItem() + 1) {
viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
} else {
Toast.makeText(this, "is end", Toast.LENGTH_SHORT).show();
}
}