【发布时间】:2011-06-27 16:51:28
【问题描述】:
我现在有点卡住了。我知道有人问过类似的问题,但我找不到任何有帮助的东西。
我正在尝试从我的 android 应用程序的内部数据库中获取并显示在 ListView 中的图像。我有一个包含 141 行的数据库,每行标记为 1,2 或 3。我需要不同的 png 图像(保存在我的 res/drawable 文件夹中)来显示取决于 1,2 或 3。这是我当前的询问。任何的建议都受欢迎。我意识到可能有更好的方式来显示我需要的信息。
public void whosnext(View view) {
// || is the concatenation operation in SQLite
cursor = db.rawQuery("SELECT * FROM eventsv1 WHERE start_time > (DATETIME('now')) AND title LIKE ? ORDER BY date ASC, time DESC",
new String[]{"%" + searchText.getText().toString() + "%"});
adapter = new SimpleCursorAdapter(
this,
R.layout.artist_list_item,
cursor,
new String[] {"title", "time", "date", "title3", "style"},
new int[] {R.id.title, R.id.time, R.id.date, R.id.title3, R.id.style});
setListAdapter(adapter);
}
【问题讨论】:
标签: android sqlite android-listview android-imageview