Identifier expected after this token

Cursor cursor = db.query(true, "user", new String[]{"id","mode"}, "id=?", new String[]{"1"}, null, null, "1,2", null);
cursor.moveToNext();

如上,

在用数据库的Cursor的moveToNext方法时,出现了题中的报错。

经百度,发现这两句需要放在public方法中才行。放入public void onCreate() 方法中之后错误消失。

 

posted @ 2013-11-18 16:11  LarryLawrence  阅读(1035)  评论(0)    收藏  举报