2015-10-18 107 views

回答

1

你可以使用這樣的東西: SQLiteDatabase db = this.getReadableDatabase();

// 2. build query 
Cursor cursor = 
     db.query(TABLE_NAME, // a. table 
     COLUMNS, // b. column names 
     " id = ?", // c. selections 
     new String[] { String.valueOf(id) }, // d. selections args 
     null, // e. group by 
     null, // f. having 
     null, // g. order by 
     null); // h. limit 

更多信息:http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html

+0

感謝您的回覆得到imageTicket列。我想在ActiveAndroid查詢! –

+0

https://guides.codepath.com/android/activeandroid-guide ...這個鏈接會有幫助 –

3

這裏是我的代碼從MyTable的

private ArrayList<MyTable> myTableList = new ArrayList<MyTable>(); 
// to get all table data 
myTableList = new Select().from(MyTable.class).execute(); 

for(int i = 0; i < myTableList.size(); i++){   
    String imageTicket = myTableList.get(i).getImageTicket(); 
    // do something with imageticket value 
}