2013-02-06 91 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();