Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Self-Destructing Message Android App Using Fragments for Tabs Modifying Fragments from the Template

Nahuel Miranda
Nahuel Miranda
2,048 Points

Cannot get the modified Fragment to run without errors

I followed thru with every instruction up till now, read every post (like https://teamtreehouse.com/forum/android-studio-return-new-inboxfragment and https://teamtreehouse.com/forum/feeling-lost-regarding-default-fragments-following-the-adt-update) but I'm still getting errors. This is getting quite frustrating! could anybody help? last error message is the below:

27824-27824/com.example.nmiranda.ribbit E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list' at android.support.v4.app.ListFragment.ensureList(ListFragment.java:344) at android.support.v4.app.ListFragment.onViewCreated(ListFragment.java:145) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:956) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1121) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1484) at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:482) at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:141) at android.support.v4.view.ViewPager.populate(ViewPager.java:1073) at android.support.v4.view.ViewPager.populate(ViewPager.java:919) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441) at android.view.View.measure(View.java:15288) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4876) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.java:15288) at android.widget.LinearLayout.measureVertical(LinearLayout.java:833) at android.widget.LinearLayout.onMeasure(LinearLayout.java:574) at android.view.View.measure(View.java:15288) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4876) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2397) at android.view.View.measure(View.java:15288) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1974) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1217) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1390) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1113) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4481) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725) at android.view.Choreographer.doCallbacks(Choreographer.java:555) at android.view.Choreographer.doFrame(Choreographer.java:525) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4856) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) at dalvik.system.NativeStart.main(Native Method)

5 Answers

Hey Nahuel! The error message seems to be complaining about the id of your ListView in your layout file. Did you make sure android:id is set to "@android:id/list" for the ListView?

Nahuel Miranda
Nahuel Miranda
2,048 Points

wow thanks! that was it. I had the ID of the listview defined as a new ID, not as android:id. Still more tweaking required, but now it's running without errors. Much appreciated Kristen!

Noam Elbaz
Noam Elbaz
5,672 Points

Kristen Law thanks alot. I was breaking my head through all these instructions. Turns out I just messed up the ID's. I was using @id/list and not @android:id=list

Noam Elbaz
Noam Elbaz
5,672 Points

Ben Jakuben see Kristen Law's answer above. I did everything in the instructions / teacher's notes. Nothing worked until I read here that the list ID's had to be @android:id. After that everything worked fine.

Mauricio Liu
Mauricio Liu
1,141 Points

This helped me a lot, thank you Kristen.