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

  • SEARCH
  • Home
  • 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 7817123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:07:34+00:00 2026-06-02T06:07:34+00:00

I have implemented the ViewPagerIndicator with ActionBarSherlock. Now i would like to open a

  • 0

I have implemented the ViewPagerIndicator with ActionBarSherlock.

Now i would like to open a specific fragment inside the viewpager once the viewpager is created. Normally you should use setCurrentItem(pageid) or setViewPager(mPager, pageid);

But this doesn’t work 🙁 If I would like to open fragment 2 inside the viewpager, the
viewpager indicator shows that fragment 2 is shown, but in reality fragment one (standard) is shown in the viewpager.

I have the following code:

 @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.simple_tabs);

        mAdapter = new ColofonFragmentAdapter(getSupportFragmentManager());

        mPager = (ViewPager)findViewById(R.id.pager);
        mPager.setAdapter(mAdapter);
        mIndicator = (TabPageIndicator)findViewById(R.id.indicator);
        String page = "";
        page = getIntent().getStringExtra("page");
        int pageid = 0;
        if(page.equals("contact")) { pageid = 0; }
        else if(page.equals("colofon")) { pageid = 1; }
        else if(page.equals("disclaimer")) { pageid = 2; }      

        mIndicator.setViewPager(mPager, pageid); // Doesn't work...
            //mIndicator.setCurrentItem(pageid); // Doesn't work...
    }

class ColofonFragmentAdapter extends FragmentPagerAdapter implements TitleProvider {

        ArrayList<Fragment> fragments = new ArrayList<Fragment>();
        ArrayList<String> titels = new ArrayList<String>();

        public ColofonFragmentAdapter(FragmentManager fm) {
            super(fm);
            fragments.add(new LayoutFragment(R.layout.colofon_contactgegevens));
            titels.add("Contact");
            fragments.add(new LayoutFragment(R.layout.colofon_colofon));
            titels.add("Colofon");
            fragments.add(new LayoutFragment(R.layout.colofon_disclaimer));
            titels.add("Disclaimer");
        }


        @Override
        public Fragment getItem(int position) {
            return fragments.get(position);
        }

        @Override
        public int getCount() {
            return fragments.size();
        }

        @Override
        public String getTitle(int position) {
            return titels.get(position);
        }
    }

Can you tell me which method I should use to change the initial page?
Thank you!

  • 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-02T06:07:36+00:00Added an answer on June 2, 2026 at 6:07 am

    I think it was a bug caused by setCurrentItem()
    https://github.com/JakeWharton/Android-ViewPagerIndicator/pull/76

    It’s solved ^^

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

Sidebar

Related Questions

I have implemented a simple linked list class and I would now like to
I have implemented button which clicks and opens dialog with spinner inside as described
I have implemented a console calculator application. It stores variables as well. Now I
I have implemented the A* algorithm in AS3 and it works great except for
I have implemented Facebook Connect into a HTML page exactly as the tutorial explains
I have implemented a VSS requester, and it links compiles and executes on Windows
I have implemented a ToString() override method for my class in my Webservice and
I have implemented a sort of Repository class and it has has GetByID ,
I have implemented a DAL using Rob Conery's spin on the repository pattern (from
I have implemented a printer delivery extension based on MS example in SSRS 2005.

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.