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 trialAlex Hexan
Courses Plus Student 769 PointsError with the "return new InboxFragment()" method.
'''java @Override 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 new InboxFragment(); '''
The error i am getting is: Incompatible types : Required: android.support.v4.app.fragment, Found: com.example.appname.InboxFragment
1 Answer
James Simshaw
28,738 PointsHello,
I'm guessing that your InboxFragment isn't exending anything at all. Could you try having it extend Fragment (while importing android.support.v4.app.Fragment). Let me know if this helps. If not, could you post your current version of your code(both where the error is found and the InboxFragment). That would help us be able to assist you further.
Alex Hexan
Courses Plus Student 769 PointsAlex Hexan
Courses Plus Student 769 PointsNo need for the code. Apparently there were some imports missing and i misspelled some other things. woops!
James Simshaw
28,738 PointsJames Simshaw
28,738 PointsGlad you were able to get it working. Good luck with Android development.