首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

How to get a tables columns arraylist on Android

2012-08-17 
How to get a tables columns arraylist on Android?Cursor ti db.rawQuery(PRAGMA table_info(mytable

How to get a tables columns arraylist on Android?

Cursor ti = db.rawQuery("PRAGMA table_info(mytable)", null);    if ( ti.moveToFirst() ) {        do {            System.out.println("col: " + ti.getString(1));        } while (ti.moveToNext());    }
?

?

try {        Cursor c = db.query(tableName, null, null, null, null, null, null);        if (c != null) {            int num = c.getColumnCount();            for (int i = 0; i < num; ++i) {                String colname = c.getColumnName(i);            }        }    } catch (Exception e) {        Log.v(tableName, e.getMessage(), e);        e.printStackTrace();    }
?

热点排行