2011-02-07 30 views

回答

1

in Button click listenerü將獲取所有數據的代碼寫入一個列表,然後將這個列表排列到您的列表視圖中。

下面的代碼被用於從源碼

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

獲取數據,以便進一步inforamtion見下面的鏈接

SQLite in android

相關問題