1
在我的应用程序中,我有1个listview,使用arrayadapter从数据库填充数据。Listview在Android中填充
这里是下面的代码:
public void onClick(View v) {
// TODO Auto-generated method stub
Cursor c = db.gethouseholdTitle();
startManagingCursor(c);
// if(cat.equals("Income"))
// {
//// System.out.println("inside if="+select);
//// Cursor cin = db.income();
String[] fromdes = new String[] {db.KEY_DATE,db.KEY_DESC,db.KEY_INCOME,db.KEY_TOTAL};
int[] todes = new int[] {R.id.text1 ,R.id.text3,R.id.text5,R.id.text7};
SimpleCursorAdapter notes =
new SimpleCursorAdapter(this, R.layout.columnview, c, fromdes, todes);
// System.out.println("notes="+notes.getCount());
// setListAdapter(notes);
lv.setAdapter(notes);
}
但是示值误差:
The constructor SimpleCursorAdapter(new View.OnClickListener(){}, int, Cursor, String[], int[]) is undefined
什么,我在做advance.I认为wrong.Thanks我们不能能填补点击功能里面光标适配器??
在onclick的背景下被改变。所以,你必须在放置'** this **'之前放置YourActivityName。提供YourActivity的背景。 – 2012-07-16 13:42:18