我正在开发一个与 SQLite 数据库一起使用的小应用程序...我正在显示取决于优先级的图片(绿色、黄色或红色)。我有 3 个优先级(高、中和低......),我得到的光标如下:
cursorh = dbAdapter.fetchAllHighPrio();
cursorm = dbAdapter.fetchAllMedPrio();
cursorl = dbAdapter.fetchAllLowPrio();
然后我打电话给其他一些像这样的东西:
startManagingCursor(cursorh);
startManagingCursor(cursorm);
startManagingCursor(cursorl);
String[] from = new String[] { TodoDbAdapter.KEY_SUMMARY };
int[] to = new int[] { R.id.label };
SimpleCursorAdapter noteh = new SimpleCursorAdapter(this,
R.layout.todo_row_high, cursorh, from, to);
SimpleCursorAdapter notem = new SimpleCursorAdapter(this,
R.layout.todo_row_med, cursorm, from, to);
SimpleCursorAdapter notel = new SimpleCursorAdapter(this,
R.layout.todo_row_low, cursorl, from, to);
所以我已经准备好在我的列表中显示我的所有东西......但如果我使用 setListAdapter 我只能使用其中的 1 个。因为我有 3 种不同的布局和不同的光标,所以这真的很难做到。我怎样才能让所有这 3 个 SimpleCursorAdapter 现在显示在我的列表中?
编辑:也许我不够清楚......所有这些数据都只在一个表中......但由于我有 3 种不同的布局(因为不同的优先级颜色)我需要单独添加它们......或者有没有换句话说,如果优先级等于“高”,则将此图像放入布局中,所以我只需要一个 SimpleCursorAdapter?