protected void createViewPager(final long initialPageId, final long[] orderedPages, final Action1<Long> onPageChangeListener, final boolean isRefreshable) {
        this.isRefreshable = isRefreshable;
        this.initialPageId = initialPageId;
        this.initialPageShown = false;
        this.currentPageId = initialPageId;
        setOrderedPages(orderedPages);
        this.onPageChangeListener = onPageChangeListener;

        setContentView(isRefreshable ? R.layout.tabbed_viewpager_activity_refreshable : R.layout.tabbed_viewpager_activity);

        viewPager = findViewById(R.id.viewpager);
        viewPager.setAdapter(new ViewPagerAdapter(this));
        viewPager.registerOnPageChangeCallback(pageChangeCallback);
        viewPager.setCurrentItem(pageIdToPosition(currentPageId), false);
        viewPager.setOffscreenPageLimit(10);

        swipeRefreshLayout = findViewById(R.id.swipe_refresh);
        if (swipeRefreshLayout != null) {
            final DisplayMetrics outMetrics = new DisplayMetrics();
            getWindowManager().getDefaultDisplay().getMetrics(outMetrics);

            final float dpHeight = outMetrics.heightPixels / getResources().getDisplayMetrics().density;
            final int mDistanceToTriggerSync = (int) (dpHeight * 0.7);

            // initialize and register listener for pull-to-refresh gesture
            swipeRefreshLayout.setDistanceToTriggerSync(mDistanceToTriggerSync);
            swipeRefreshLayout.setOnRefreshListener(() -> {
                        swipeRefreshLayout.setRefreshing(false);
                        pullToRefreshActionTrigger();
                    }
            );
        }

        new TabLayoutMediator(findViewById(R.id.tab_layout), viewPager, (tab, position) -> {
            this.fragmentTabMap.put(position, tab);
            tab.setText(getTitle(getItemId(position)));
        }).attach();
    }
Set if the content is refreshable. Defaults to true if the Activity contains a {@link SwipeRefreshLayout}.
main/src/main/java/cgeo/geocaching/activity/TabbedViewPagerActivity.java