android - 当我尝试在 google 的数据库教程中创建 SQL_CREATE_ENTRIES 时出现错误 ._ID undefined
问题描述
我正在尝试使用 google 使用 sqlite 文档获取数据来学习 sqllight,
但获得 _ID 未在该行中定义错误
private static final String SQL_CREATE_ENTRIES =
"CREATE TABLE " + FeedEntry.TABLE_NAME + " (" +
FeedEntry._ID + " INTEGER PRIMARY KEY," +
FeedEntry.COLUMN_NAME_TITLE + " TEXT," +
FeedEntry.COLUMN_NAME_SUBTITLE + " TEXT)";
FeedReaderContract 类
public final class FeedReaderContract {
// To prevent someone from accidentally instantiating the contract class,
// make the constructor private.
private FeedReaderContract() {}
/* Inner class that defines the table contents */
public static class FeedEntry implements BaseColumns {
public static final String TABLE_NAME = "entry";
public static final String COLUMN_NAME_TITLE = "title";
public static final String COLUMN_NAME_SUBTITLE = "subtitle";
}
}
_ID 未在 FeedEntry 类中定义,但谷歌说通过实现 BaseColumns 接口,您的内部类可以继承一个名为 _ID 的主键字段
那么为什么_ID comming up as undefined shouldent FeedEntry 继承它呢?
解决方案
推荐阅读
- docker - Travis 条件构建 - 如何跳过除主分支之外的部署阶段
- java - 使用 charAt() 时无法打印字符串
- mysql - GoLang 的配置返回“非名称”错误
- cvxpy - 尝试为正半定锥约束创建约束时,问题不遵循 DCP 规则
- java - 为多个主类创建 1 个 jar 文件
- python-3.x - 为什么“全局”在“如果”中不起作用?
- regex - 正则表达式分别在任何地方查找匹配项
- android - 使用 google_maps_autocomplete 后 Flutter 无法运行
- python - 导入时的 Pandas 多种 dtype
- ios - iOS 上使用套接字的 P2P 连接