2011-01-13 6 views
0

내 SQL 데이터베이스 테이블에는 _id, int dayofweek, String 텍스트가 있습니다. 이제 테이블에 SQL 쿼리를 실행하여 결과에 커서를 놓습니다. 다음리스트 뷰에 표시되는 결과안드로이드 : cursor/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); 
} 

방법 (및) 지금 해당 문자열로 DAYOFWEEK의 정수 값을 대체 할 수 있는가? 나는 쿼리하는 동안 두 개의 테이블을 결합하는 것에 대해 생각했지만 더 이상 다국어가되지는 않습니다.

답변

3

당신은 당신의 SimpleCursorAdapterViewBindersetViewBinder()를 통해를 사용하여 시도 할 수 있습니다로 교체 할 수 있습니다보다 수 있습니다.

또는 SimpleCursorAdapter을 확장하고 bindView()을 재정 의하여 직접 해보십시오.

0

직접 목록에 먼저 저장해야 우선은 값을 대체하고 UR 원하는 fromat

관련 문제