Click here to Skip to main content
15,897,273 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hey guys, i'm trying to run my Messenger app in android studio, it's Compilation finishes successfully, but after Emulator Starts the app, it suddenly it shows "Force Close" and terminates the process.
<the log below is what happens.>
can you help me solve this please?

07-12 10:12:33.589    2913-2913/com.hooman.chitchat I/art﹕ Not late-enabling -Xcheck:jni (already on)
07-12 10:12:33.654    2913-2913/com.hooman.chitchat D/AndroidRuntime﹕ Shutting down VM
07-12 10:12:33.654    2913-2913/com.hooman.chitchat E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.hooman.chitchat, PID: 2913
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hooman.chitchat/com.hooman.chitchat.ListOfFriends}: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
            at android.app.ListActivity.onContentChanged(ListActivity.java:243)
            at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:381)
            at android.app.Activity.setContentView(Activity.java:2144)
            at com.hooman.chitchat.ListOfFriends.onCreate(ListOfFriends.java:176)
            at android.app.Activity.performCreate(Activity.java:5933)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)


it's the XML code which contains list view

XML
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">

    <ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/list"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true" />
</LinearLayout>
Posted
Updated 12-Jul-15 1:32am
v2

1 solution

Based on the error message you're missing a proper ListView:
Your content must have a ListView whose id attribute is 'android.R.id.list'

If that's not true, please post the XML containing the listview.
 
Share this answer
 
v2
Comments
HOoman.2012 12-Jul-15 7:30am    
i Renamed the list view id o list, but still there is no good news...
Still Force Close...
HOoman.2012 12-Jul-15 7:33am    
i have added the XML Code
Wendelius 12-Jul-15 7:41am    
Not entirely sure but should the list view look like

<ListView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@android:id/list"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900