Ejemplo n.º 1
0
  /*
   *
   *   Article Flag
   *
   * */
  public boolean addArticle(Article art) {
    if ((art.getTitleArticle() == null)
        || (art.getDateArticle() == null)
        || (art.getIdFlagArticle() == 0)) {
      return false;
    }
    if (this.articleExist(art.getTitleArticle()) == false) {

      SQLiteDatabase db = this.getWritableDatabase();
      ContentValues content = new ContentValues();
      content.put(TITLE_ARTICLE, art.getTitleArticle());
      content.put(CONTENT_ARTICLE, art.getContentArticle());
      content.put(URL_ARTICLE, art.getUrlArticle());
      content.put(URL_PICTURE, art.getUrlPicture());
      content.put(DOWNLOAD_PICTURE, art.getDownloadPicture());
      content.put(ID_FLAG_ARTICLE, art.getIdFlagArticle());
      content.put(DATE_ARTICLE, art.getDateArticle().toString());

      if (db.insert(DATABASE_TABLE_Article, null, content) == -1) return false;
      return true;
    }
    return false;
  }