我在使用记事本示例中的某些功能时遇到了问题.这是NotepadCodeLab/Notepadv1Solution中的代码:
String[] from = new String[] { NotesDbAdapter.KEY_TITLE };
int[] to = new int[] { R.id.text1 };
SimpleCursorAdapter notes = new SimpleCursorAdapter(this,
R.layout.notes_row, c, from, to);
Run Code Online (Sandbox Code Playgroud)
这段代码似乎工作正常.但为了清楚起见,我运行了ADB 实用程序并运行SQLite 3.我检查了架构如下:
sqlite> .schema
CREATE TABLE android_metadata (locale TEXT);
CREATE TABLE notes (_id integer primary key autoincrement, title text
not null, body text not null);
Run Code Online (Sandbox Code Playgroud)
一切对我来说都很好.
现在我的应用程序,据我所知,基本相同,只有一些小的改动.我简化并简化了我的代码,但问题仍然存在.
String[] from = new String[] { "x" };
int[] to = new int[] { R.id.x };
SimpleCursorAdapter adapter = null;
try
{
adapter = new …Run Code Online (Sandbox Code Playgroud)