I have to create a list view , with each item getting a separate icon along the right hand side. I have written a code , but its not working ? how do I proceed ? application cra
Caused by: java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
You are Using ListActivity
and also setting content setContentView()
. ListActivity
by default has a ListView
and does not needs an xml layout. However if you want to provide an xml layout, your layout MUST have a ListView
element with id set to @android:id/list
.
About the contents, You can always inflate a menu.xml in a Menu
and use it like a data Array. Luckily each MenuItem
has a title and icon. Also Menu
has size()
and getItem()
methods.