0

I'm trying to launch an android activity from my Main activity, but I get force stop. The logcaterror is like this:

java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

But the activity that I try to launch already has a ListView with the id "list". Any advice is appreciated. UPDATE: Still can't figure out what's wrong. Here's my code:

activity_all_apps.xml

<RelativeLayout 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="com.example.app.AllAppsActivity">

 <ListView
    android:id="@android:id/list"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />

</RelativeLayout>

and AllAppsActivity.java

public class AllAppsActivity extends ListActivity
Alex Newman
  • 1,369
  • 12
  • 34
  • Please show layout xml which contain ListView – ρяσѕρєя K Aug 10 '15 at 17:57
  • 1
    [Take a look at the accepted answer on this post](http://stackoverflow.com/questions/3040374/runtimeexception-your-content-must-have-a-listview-whose-id-attribute-is-andro) – PPartisan Aug 10 '15 at 18:05
  • paste some code here, what have you tried? – mushahid Aug 10 '15 at 18:56
  • [This](http://stackoverflow.com/questions/4355614/what-is-difference-between-id-androidlist-and-id-list) is another link to consider. Posting code would probably help, but chances are the two links will offer enough help to get you past this. Let us know how it worked out or post some code if the links don't help. – DSlomer64 Aug 10 '15 at 19:06
  • Change id to `@android:id/list` –  Aug 10 '15 at 19:08

1 Answers1

0

In your XML layout file related to this Activity you should have a ListView element that whose id is @android:id/list. Something like this.

<ListView
    android:id="@android:id/list"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

</ListView>
frogatto
  • 28,539
  • 11
  • 83
  • 129