Logcat Error-content Must Have A Listview Whose Id Attribute Is 'android.r.id.list'
My list view is showing error like this what i mention in my question,eventhough i mention in mainactivity extends listactivity also and my layout i put as listview activity_list_i
Solution 1:
you just have to change the id of you list view in activity_list_item.xml to @android:id/list If you use a ListActivity you listview id must be like mentionned
Solution 2:
Change your layout to,
<?xml version="1.0" encoding="utf-8"?><ListViewxmlns:android="http://schemas.android.com/apk/res/android"android:id="@android:id/list"android:layout_width="match_parent"android:layout_height="match_parent"
/>
Solution 3:
Remove the call to setContentView
.
ListActivity
does not require that you assign a layout to it via the setContentView() method, if you only want to show a ListView ListActivity contains by default a ListView.
In case you need to include more Views than a ListView in your ListActivity you can still assign a layout to your activity. In this case your layout must contain a ListView with the android:id
attribute set to @android:id/list
.
Post a Comment for "Logcat Error-content Must Have A Listview Whose Id Attribute Is 'android.r.id.list'"