我不知道在光标中获取日期的正确代码是什么,因为错误说:
无法解析构造函数“Website(int, java.util.String, java.util.String)”
我的构造函数是:
public Website(int id, Date stamped, String url, String content){
this._id = id;
this._stamped = stamped;
this._url = url;
this._content = content;
}
光标是:
Website getWebsite(int id) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(TABLE_WEBSITE, new String[] { KEY_ID,
KEY_STAMPED, KEY_URL, KEY_CONTENT }, KEY_ID + "=?",
new String[] { String.valueOf(id) }, null, null, null, null);
if (cursor != null)
cursor.moveToFirst();
Website website = new Website(Integer.parseInt(cursor.getDate(0)),
cursor.getString(1), cursor.getString(2));
// return contact
return website;
}