2011-01-13 47 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