public void insertData(News news) { ContentValues contentValues = new ContentValues(); contentValues.put(ID, news.getId()); contentValues.put(RESOURCE, news.getResource().getName()); contentValues.put(DATE, news.getDate()); contentValues.put(TITLE, news.getTitle()); contentValues.put(LINK, news.getLink()); database.insert(TABLE_NAME, null, contentValues); }
private News parseData(Cursor cursor) { News curData = new News(); curData.setId(cursor.getInt(0)); Resource r = new Resource(); r.setId(1); r.setName(cursor.getString(1)); curData.setResource(r); curData.setDate(cursor.getString(2)); curData.setTitle(cursor.getString(3)); curData.setLink(cursor.getString(4)); return curData; }