RestoreDbTask.java 文件源码

java
阅读 15 收藏 0 点赞 0 评论 0

项目:FlickLauncher 作者:
/**
 * Returns the profile id used in the favorites table of the provided db.
 */
protected long getDefaultProfileId(SQLiteDatabase db) throws Exception {
    try (Cursor c = db.rawQuery("PRAGMA table_info (favorites)", null)){
        int nameIndex = c.getColumnIndex(INFO_COLUMN_NAME);
        while (c.moveToNext()) {
            if (Favorites.PROFILE_ID.equals(c.getString(nameIndex))) {
                return c.getLong(c.getColumnIndex(INFO_COLUMN_DEFAULT_VALUE));
            }
        }
        throw new InvalidObjectException("Table does not have a profile id column");
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号