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 trialRodrigo Ayala
2,791 PointsAdding 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
Shawn Anderton
24,124 Pointsoops, I have extra . in pagerAdapter.getPageTitle(i)
Shawn Anderton
24,124 Pointsneed to call the getPageTitle() from the PagerAdapter's class. so need change mActionBar.getPageTitle(i) to pagerAdapter..getPageTitle(i)
Rodrigo Ayala
2,791 PointsThanks for the help Shawn! Solved it!