這是我的數據庫處理程序代碼..與導航鍵的Android的ListView ...需要幫助
// Getting All detail
public List<Detail> getAllDetail() {
List<Detail> detailList = new ArrayList<Detail>();
// Select All Query
String selectQuery = "SELECT * FROM " + TABLE_DETAIL;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
Detail detail = new Detail();
detail.setID(Integer.parseInt(cursor.getString(0)));
detail.setTitle(cursor.getString(1));
detail.setDetail(cursor.getString(2));
// Adding contact to list
detailList.add(detail);
} while (cursor.moveToNext());
}
我需要在一個活動類,其佈局文件看起來像一個按鈕樣的一個列表視圖檢索這些細節這個..
按鈕應該被分配數據庫行..點擊它應該去另一個活動,其中特定行的細節視圖完全時的ID ..
請幫助我..在此先感謝..
不行。這是一個樣。我需要的東西鏈路上,這..請幫助他在如何實現這個.. – 2012-04-11 13:14:31
好吧,如果你從遊標獲取所有數據,那麼我們有遊標適配器,併爲此我們有Android SDK示例中的示例應用程序。只要看看它,你就會對它有完整的想法。 – 2012-04-12 07:00:35