Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9207049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:18:21+00:00 2026-06-18T00:18:21+00:00

Libraries: https://github.com/chrisbanes/Android-PullToRefresh https://github.com/JakeWharton/Android-ViewPagerIndicator In the Sample PullToRefreshListInViewPagerActivity only works with PageAdapter. I couldn’t find

  • 0

Libraries:

  • https://github.com/chrisbanes/Android-PullToRefresh
  • https://github.com/JakeWharton/Android-ViewPagerIndicator

In the Sample PullToRefreshListInViewPagerActivity only works with PageAdapter.

I couldn’t find a way to put it to work with FragmentPageAdapter.

Sample:

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_ptr_list_in_vp);

        mViewPager = (ViewPager) findViewById(R.id.vp_list);
        mViewPager.setAdapter(new ListViewPagerAdapter());
    }

    private class ListViewPagerAdapter extends PagerAdapter {

        @Override
        public View instantiateItem(ViewGroup container, int position) {
            Context context = container.getContext();

            PullToRefreshListView plv = (PullToRefreshListView) LayoutInflater.from(context).inflate(
                    R.layout.layout_listview_in_viewpager, container, false);

            ListAdapter adapter = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1,
                    Arrays.asList(STRINGS));
            plv.setAdapter(adapter);

            plv.setOnRefreshListener(PullToRefreshListInViewPagerActivity.this);

            // Now just add ListView to ViewPager and return it
            container.addView(plv, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

            return plv;
        }

        @Override
        public void destroyItem(ViewGroup container, int position, Object object) {
            container.removeView((View) object);
        }

        @Override
        public boolean isViewFromObject(View view, Object object) {
            return view == object;
        }

        @Override
        public int getCount() {
            return 3;
        }

    }

    @Override
    public void onRefresh(PullToRefreshBase<ListView> refreshView) {
        new GetDataTask(refreshView).execute();
    }

    private static class GetDataTask extends AsyncTask<Void, Void, Void> {

        PullToRefreshBase<?> mRefreshedView;

        public GetDataTask(PullToRefreshBase<?> refreshedView) {
            mRefreshedView = refreshedView;
        }

        @Override
        protected Void doInBackground(Void... params) {
            // Simulates a background job.
            try {
                Thread.sleep(4000);
            } catch (InterruptedException e) {
            }
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            mRefreshedView.onRefreshComplete();
            super.onPostExecute(result);
        }
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:18:21+00:00Added an answer on June 18, 2026 at 12:18 am

    You can add a ListFragment to the FragmentPageAdapter (or FragmentStatePageAdapter) and add the Pull-To-Refresh feature on it.

    The Android-PullToRefresh repository has an example about ListFragment.

    The Android Developers website has a sample code on how to make FragmentPagerAdapter or FragmentStatePagerAdapter.

    You can also take a look at my test project: https://github.com/caiguanhao/FSPAtest

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen a few libraries ( e.g https://github.com/brow/leaves ) on how to implement
The class I wish to use is: https://github.com/philsturgeon/codeigniter-curl/blob/master/libraries/Curl.php How can I use this in
I'm trying to call this XML-RPC Method from Android(http://foxrate.org/) using this libraries https://github.com/timroes/aXMLRPC The
I downloaded SwiffCore (https://github.com/musictheory/SwiffCore) for iOS and the Demo project contains a the main
I am trying to converting a non-ARC project ( https://github.com/allaboutapps/A3GridTableView ) to ARC using
I've attempted to write a binding project for this project: https://github.com/tolo/HHServices The Project uses
When I look into the implementation of FRIEND_TEST at https://github.com/google/googletest/blob/master/googletest/include/gtest/gtest_prod.h , I see the
I'm implementing Simpleauth by Alex on my App Engine (Python 2.7) app: https://github.com/crhym3/simpleauth and
The ScalaSignature is an annotation. It contains meta informations. https://github.com/scala/scala/blob/v2.9.2/src/library/scala/reflect/ScalaSignature.java And then parser is
I have a rather complex application at https://github.com/BigBadOwl/iStreamer-Download-Manager which uses Rtmpdump and Ffmpeg libraries

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.