我知道这个问题听起来很熟悉,你会告诉我,我应该找到我的答案,如果对它进行一点搜索......但没有什么是为我工作!动态添加图像到ListView
我需要一个可以动态添加特定图像到每一行内容的代码!
super.onCreate(savedInstanceState);
DatabaseHelper helper = new DatabaseHelper(this);
database = helper.getWritableDatabase();
Cursor data = database.query("names", fields, null, null, null, null,
null);
dataSource = new SimpleCursorAdapter(this, R.layout.row, data, fields,
new int[] { R.id.first, R.id.last });
ListView view = getListView();
view.setHeaderDividersEnabled(true);
view.addHeaderView(getLayoutInflater().inflate(R.layout.row, null));
setListAdapter(dataSource);
}
已经使用SQLite作为一个标签,但并没有提到关于使用数据库的任何东西。你没有提供你已经尝试过的和没有工作的代码。你向我们索要的代码不是这个社区支持的。所以再试一次,改善问题。你卡在哪里?到目前为止你做了什么? – WarrenFaith 2011-04-26 13:24:59
我有一个列表视图,其中包含名称和姓氏。 – AnthonyK 2011-04-26 13:28:27
我想在文本前输入国家国旗(姓名,姓氏) – AnthonyK 2011-04-26 13:29:06