2011-01-13 60 views
0

在我的SQL数据库表中有colums _id,int dayofweek,String text ... 我现在对该表执行SQL查询以获得游标到结果。 结果然后被示出在ListView:Android:替换游标/ sql查询的值

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); 
} 

如何(和位置)可以我现在通过相应的串替换星期几的整数值?我想在查询时加入两张桌子,但不会再多语言了。

回答

3

您可以尝试在你的SimpleCursorAdapter使用ViewBinder通过setViewBinder()更换。

或延长SimpleCursorAdapter覆盖bindView()并自己动手。

0

你不能直接替换。你必须首先将其存储在列表中的值,比你可以用UR所需fromat