I need to extend the ListActivity and populate a custom layout so I do the following
public class BizList extends ListActivity {
String bizNames[]={"one", "two","theree","four"};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.bizlist);
//ListView listviewMe = (ListView)findViewById(android.R.id.list);
//ListView listview = this.getListView();
setListAdapter(new ArrayAdapter<String>(this, android.R.id.list, bizNames));
/* ListView list1 = (ListView) findViewById(R.id.listView1);
list1.setAdapter(new ArrayAdapter<String>(getApplicationContext(),R.layout.list_item,startDates_str));;*/
}
and my ListView in my layout is
<ListView
android:id="@id/android:list"//***have also tried*** android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/imageView2"
android:layout_centerHorizontal="true" >
</ListView>
but I keep getting this error
android.content.res.resources$notfoundexception: File form xml type layout resoucse ID
Any and all help is greatly appreciated. I hope it’s something simple. thx agin.
Firstly for
ListActivityto automatically find the list, the resource id MUST be…Secondly, when you create the
ArrayAdapter, don’t pass the id of theListViewitself into the constructor. Instead you should pass the resource id of a list item layout.Try this…