Posts

Showing posts with the label fragmentstatepageradapter

Inform when view is displaying in FragmentStatePagerAdapter Android

Inform when view is displaying in FragmentStatePagerAdapter Android I'm trying to create slideshow something like Instagram stories. I write some code and everything is working fine. I'm using Handler.postDelay to change the slide. I want to prevent changing slide when slide is video type it stop thread until video is loaded after loading video it start again handler thread. Check code for better understanding. Handler.postDelay Here is my code. private class StorySlidePagerAdapter extends FragmentStatePagerAdapter { public StorySlidePagerAdapter(FragmentManager fm) { super(fm); Log.i("StoryActivityDebug", "StorySlidePagerAdapter constructor"); } @Override public Fragment getItem(int position) { Log.i("StorySlideDebug", "getItem position " + position); StorySlide storySlide = StorySlide.create(position); storySlide.setOnStoryLoad(StoryActivity.this); return storySlide; }...