public void add ( Article article ) { // Get Write Access SQLiteDatabase db = this . getWritableDatabase ( ) ; // Build Content Values ContentValues values = new ContentValues ( ) ; values . put ( KEY_TAGS , TextUtils . join ( "_PCX_" , article . getTags ( ) ) ) ; values . put ( KEY_MEDIA_CONTENT , Article . MediaContent . toByteArray ( article . getMediaContent ( ) ) ) ; values . put ( KEY_SOURCE , article . getSource ( ) . toString ( ) ) ; values . put ( KEY_IMAGE , article . getImage ( ) . toString ( ) ) ; values . put ( KEY_TITLE , article . getTitle ( ) ) ; values . put ( KEY_DESCRIPTION , article . getDescription ( ) ) ; values . put ( KEY_CONTENT , article . getContent ( ) ) ; values . put ( KEY_COMMENTS , article . getComments ( ) ) ; values . put ( KEY_AUTHOR , article . getAuthor ( ) ) ; values . put ( KEY_DATE , article . getDate ( ) ) ; values . put ( KEY_ID , article . getId ( ) ) ; // Insert & Close db . insert ( TABLE_ARTICLES , null , values ) ; db . close ( ) ; }
Inserts an Article object to this database .