如何在android中调用setListAdapter

时间:2009-08-10 10:11:10

标签: android listview

我有一个类没有从ListActivity扩展,所以如何在没有错误的情况下替换此代码?

SimpleCursorAdapter adapter = new SimpleCursorAdapter(
  this,
  R.layout.sbooks_row,
  cursor, from,
  to
);
setListAdapter(adapter);

1 个答案:

答案 0 :(得分:48)

ListView myList=(ListView)findViewById(android.R.id.list);

myList.setAdapter(adapter);