0

Fatal exception. I am kind a new in android programming so hopefully you can get it. For more info or more code just write a comment I can add.

here is the error:

03-17 17:38:42.641: E/AndroidRuntime(1306): FATAL EXCEPTION: main
03-17 17:38:42.641: E/AndroidRuntime(1306): java.lang.RuntimeException: Unable to start  
activity     
ComponentInfo{com.example.mandatoryassigment/com.example.mandatoryassigment.MainActivity}: 
java.lang.RuntimeException: Your content must have a ListView whose id attribute is  
'android.R.id.list'

You have any idea? The application is trying to show the list (ListActivity).

Blackbelt
  • 156,034
  • 29
  • 297
  • 305
  • Can you post your code ? – Sharp Edge Mar 17 '14 at 18:01
  • Its already solved, guys below were right I had to create list in xml file but I dont understand it because it was working 1 hour before then something happened and it was showing this error. Dont you know why it happened like this? Thank you. – Ondrej 'zatokar' Tokár Mar 17 '14 at 18:08
  • Did you change the code in the last one hour? It has to have been changed - one possibility is that this list was being dynamically created in the java class and then that section was deleted or the xml file was changed or something like that – ucsunil Mar 17 '14 at 18:11
  • maybe you changed from Activity to ListActivity? – Blackbelt Mar 17 '14 at 18:13
  • Yes I did change the code and yes it might be possible i deleted anything in class but i did not change anything in xml file, anyway thank you at least now I know also this is possible ;D. – Ondrej 'zatokar' Tokár Mar 17 '14 at 18:14
  • Nope, all the time it was ListActivity ;) and list was nicely working etc. :) – Ondrej 'zatokar' Tokár Mar 17 '14 at 18:15

2 Answers2

4

You need to have a ListView in your xml layout that you set to the ListActivity with id android.R.id.list

 <ListView android:id="@android:id/list"
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
1

You are currently referring to a ListView object which is supposed to have an id R.id.list - which is missing in the xml file. You need to create that.

ucsunil
  • 7,378
  • 1
  • 27
  • 32