/** * Convert a cursor object from database to a user object * * @param cursor the result of a query to the database * @return the user object */ public static Notification parse(Cursor cursor) { Notification notification = new Notification(); notification.setId(cursor.getInt(0)); notification.setUserFrom(cursor.getString(0)); notification.setUserTo(User.parse(cursor)); notification.setMessage(cursor.getString(1)); notification.setType(TYPE.fromValue(cursor.getInt(0))); return notification; }