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 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!