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 Implementing Designs for Android Customizing the Action Bar Adding Icons to Tabs

Adding Icons to Tabs - Code Challenge

So the challenge asks me to set the text for each tab using the method setText() using the value returned by the PagerAdapter's getPageTitle() method:

'''

for (int i = 0; i < pagerAdapter.getCount(); i++) { ActionBar.Tab tab = mActionBar.newTab();

tab.setText(mActionBar.getPageTitle(i));

tab.setTabListener(this);

mActionBar.addTab(tab);

}

'''

Here is my code. Am i doing something wrong setting it?

3 Answers

oops, I have extra . in pagerAdapter.getPageTitle(i)

need to call the getPageTitle() from the PagerAdapter's class. so need change mActionBar.getPageTitle(i) to pagerAdapter..getPageTitle(i)

Thanks for the help Shawn! Solved it!