-2

My android app does not work, I traced the bug and found it is this error:

java.lang.RuntimeException: Unable to start activity 
ComponentInfo{com.example.twittersearches_erjan/com.example.twittersearches_erjan.MainActivity}: 
java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

How do I find R.id.list and remove this bug?

ERJAN
  • 22,540
  • 20
  • 65
  • 127
  • your xml layout should have listview widget who's name is `'android.R.id.list'` – Sagar Pilkhwal Sep 16 '14 at 10:15
  • 1
    possible duplicate of [Your content must have a ListView whose id attribute is 'android.R.id.list'](http://stackoverflow.com/questions/11050817/your-content-must-have-a-listview-whose-id-attribute-is-android-r-id-list) – Apoorv Sep 16 '14 at 10:16
  • Specify id of your list view: android:id="@+id/list" – sondt87 Sep 16 '14 at 10:17
  • Remove `import android.R;` from imports packages – TechArcSri Sep 16 '14 at 10:18
  • possible duplicate of [RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'](http://stackoverflow.com/questions/3040374/runtimeexception-your-content-must-have-a-listview-whose-id-attribute-is-andro) – Mr X Sep 16 '14 at 10:22

4 Answers4

2

in your xml layout :

<ListView
android:id="@android:id/list" //<-- replace your id tag with this
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>   
Sagar Pilkhwal
  • 5,914
  • 2
  • 27
  • 78
1

If you're extending ListActivity, try to use the follow ListView in your xml.

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

Or, you can just extend norml Activity and use your own ListView with your own id.

Ye Lin Aung
  • 10,829
  • 6
  • 44
  • 49
0

add this to your listview in the layout xml to use your own layout id

android:id="@+id/list"
FreshD
  • 2,624
  • 2
  • 20
  • 32
0
<ListView 
    android:id="@+id/list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>