Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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