2011-02-07 7 views

答えて

1

ボタンクリックリスナーでは、すべてのデータを1つのリストにまとめてリストビューに配置するコードを記述します。

以下のコードは、以下のリンク

SQLite in android

を参照してさらにinforamtionのためのSQLite

public List<String> selectAll() { 
      List<String> list = new ArrayList<String>(); 
      Cursor cursor = this.db.query(TABLE_NAME, new String[] { "name" }, 
      null, null, null, null, "name desc"); 
      if (cursor.moveToFirst()) { 
      do { 
       list.add(cursor.getString(0));<wbr> 
      } while (cursor.moveToNext()); 
      } 
      if (cursor != null && !cursor.isClosed()) { 
      cursor.close(); 
      } 
      return list; 
     } 

からデータを取得するために使用されます

関連する問題