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
Dana Rock
Courses Plus Student 1,777 PointsInbox Fragment causes error
When I change the return of the Fragment method to InboxFragment, i get an error :
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a PlaceholderFragment (defined as a static inner class
// below).
return InboxFragment();
}
I get the message "The method InboxFragment() is undefined for the type SectionsPagerAdapter.
I get the quick fix available Create method InboxFragment()
Also, I noticed that on the lesson, Ben has only android-support-v4.jar. In my libs, I have that version and also android-support-v13.jar.
Have tried deleting the v13.jar, but after deleting it, I got many errors.
The project worked find up until now.
Anyone have any ideas what I can do?
2 Answers
Joe Brown
21,465 PointsI dont remember the exact part of the project your having a problem with but I would say just from looking at your code you probably want to return a new instance/object of the InboxFragment class.. so add the word "new".. your return statement would look like .. return new InboxFragment();
Dana Rock
Courses Plus Student 1,777 PointsThank you Joe,
I just restarted the project. Found that I used the wrong Type to start off with.
Dan