2013-02-06 112 views

回答

7

就這麼簡單(db是你SQLiteDatabase對象和tableName應設置爲正確的表名數據庫內):

String tableName = ""; // your table name 
Cursor c = db.rawQuery("PRAGMA table_info(" + tableName + ")", null); 
if (c.moveToFirst()) { 
    do { 
     System.out.println("name: " + c.getString(1) + " type: " + c.getString(2)); 
    } while (c.moveToNext()); 
} 
c.close();