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 trialNahuel Miranda
2,048 PointsCannot 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
Kristen Law
16,244 PointsHey 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
2,048 Pointswow 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
5,672 PointsKristen 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
5,672 PointsBen 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
1,141 PointsThis helped me a lot, thank you Kristen.