不幸的是,应用程序显示CustumMenuActivity已经停止

时间:2012-08-22 15:50:24

标签: android

08-22 15:28:41.848: E/Trace(678): error opening trace file: No such file or directory (2)
08-22 15:28:42.387: D/AndroidRuntime(678): Shutting down VM
08-22 15:28:42.387: W/dalvikvm(678): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
08-22 15:28:42.407: E/AndroidRuntime(678): FATAL EXCEPTION: main
08-22 15:28:42.407: E/AndroidRuntime(678): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vikram.custummenuactivity/com.vikram.custummenuactivity.CustumMenuActivity}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.os.Looper.loop(Looper.java:137)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.ActivityThread.main(ActivityThread.java:4745)
08-22 15:28:42.407: E/AndroidRuntime(678):  at java.lang.reflect.Method.invokeNative(Native Method)
08-22 15:28:42.407: E/AndroidRuntime(678):  at java.lang.reflect.Method.invoke(Method.java:511)
08-22 15:28:42.407: E/AndroidRuntime(678):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-22 15:28:42.407: E/AndroidRuntime(678):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-22 15:28:42.407: E/AndroidRuntime(678):  at dalvik.system.NativeStart.main(Native Method)
08-22 15:28:42.407: E/AndroidRuntime(678): Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.ListActivity.onContentChanged(ListActivity.java:243)
08-22 15:28:42.407: E/AndroidRuntime(678):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:259)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.Activity.setContentView(Activity.java:1867)
08-22 15:28:42.407: E/AndroidRuntime(678):  at com.vikram.custummenuactivity.CustumMenuActivity.onCreate(CustumMenuActivity.java:24)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.Activity.performCreate(Activity.java:5008)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
08-22 15:28:42.407: E/AndroidRuntime(678):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
08-22 15:28:42.407: E/AndroidRuntime(678):  ... 11 more
08-22 15:33:42.558: I/Process(678): Sending signal. PID: 678 SIG: 9

2 个答案:

答案 0 :(得分:1)

所以问题不应该是棘手的。你的问题是:

  

引起:java.lang.RuntimeException:您的内容必须有   ListView的id属性为'android.R.id.list'

这意味着您ListView应具有身份证明android.R.id.list

<ListView
   android:id="@android:id/list"
   ...
/>

类似主题:

答案 1 :(得分:0)

从堆栈跟踪中: &#34;您的内容必须有一个ListView,其id属性为&#39; android.R.id.list&#34;。将此id添加到XML布局文件中的相应元素,例如: