Java Android:替换游标/sql查询的值
在我的SQL数据库表中有colums\u id、int dayofweek、字符串文本。。。 现在,我在该表上执行SQL查询,以获得指向结果的游标。 结果将显示在列表视图中:Java Android:替换游标/sql查询的值,java,android,sql,replace,adapter,Java,Android,Sql,Replace,Adapter,在我的SQL数据库表中有colums\u id、int dayofweek、字符串文本。。。 现在,我在该表上执行SQL查询,以获得指向结果的游标。 结果将显示在列表视图中: private void showBlocks() { Cursor blocks = ttDB.getBlocks(); startManagingCursor(blocks); int[] key = new int []{ android.R.id.text1,
private void showBlocks()
{
Cursor blocks = ttDB.getBlocks();
startManagingCursor(blocks);
int[] key = new int []{
android.R.id.text1,
android.R.id.text2
};
SimpleCursorAdapter blockAdapter = new SimpleCursorAdapter(
this,
android.R.layout.simple_list_item_2,
blocks,
new String[] {
"day",
"text"
},
key);
lv1.setAdapter(blockAdapter);
}
我现在如何(在哪里)用相应的字符串替换dayofweek的整数值?我想在查询时连接两个表,但它将不再是多语言的。您不能直接替换值。您必须先将其存储在列表中,然后再将其替换为所需的fromat值。您不能直接替换值。您必须先将其存储在列表中,然后再将其替换为所需的fromat值从AT开始,您可以通过
setViewBinder()
在SimpleCursorAdapter
上尝试使用ViewBinder
或者,扩展
SimpleCorsorAdapter
,覆盖bindView()
,然后自己做。您可以通过setViewBinder()
在SimpleCorsorAdapter
上尝试使用ViewBinder
或者,扩展SimpleCursorAdapter
,重写bindView()
,然后自己动手