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

After calling new FriendsFragment() and new InboxFragment() ribbit keeps crashing

After adding this Ribbit keeps crashing with the error java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

switch (position){
            case 0:
                return new InboxFragment();
            case 1:
                return new FriendsFragment();
        }
        return null;

1 Answer

Hey Alejandro!

This means that you haven't gave your ListView its ListView name!

Open up your Inbox Fragment xml file and make sure its android:id is set to android.R.id.list and you should be good to go!

I don't know where you are up to in the course but, if your Friends Fragment is also using a ListView (and not a GridView), you should also make the same change in the corresponding Friends Fragment xml file.

Hope it helps!

Thanks! it worked

I had this same issue. Mine was caused by a typo:

android:id="@android:id/list"

I had left off the android:id portion.

Thank you for posting this answer.