Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Self-Destructing Message Android App Using Fragments for Tabs Modifying Fragments from the Template

Liam Miller
Liam Miller
191 Points

How do we set the Friends Fragment to be first fragment that is launched and then scroll left

How do we set the Friends Fragment to be first fragment that is launched and then scroll left to go to inbox as oppose to aways scrolling right ? For example like Snapchat ?

1 Answer

Pablo Rocha
Pablo Rocha
10,142 Points

Liam - ignore my previous answer, I misread the question :)

In order to default to the Friends tab on the start of the application you can call the following code from the last line of the onCreate method in MainActivity.java

        mViewPager.setCurrentItem(1);
Liam Miller
Liam Miller
191 Points

AHHHHHHHHHHH Jose thank you so much it works