예제 #1
0
 public void addSong(Song song, int playlistId) {
   if (song == null) return;
   ContentValues values = new ContentValues();
   values.put(DatabaseHelper.FIELD_SONG_ID, song.getSongId());
   values.put(DatabaseHelper.FIELD_PLAYLIST_ID, playlistId);
   values.put(DatabaseHelper.FIELD_NAME, song.getName());
   values.put(DatabaseHelper.FIELD_URI, song.getUri());
   values.put(DatabaseHelper.FIELD_ALBUM_ID, song.getAlbumId());
   db.insert(DatabaseHelper.TABLE_SONGS, null, values);
 }
예제 #2
0
 public void deleteSong(Song song) {
   if (song == null) return;
   db.delete(DatabaseHelper.TABLE_SONGS, DatabaseHelper.FIELD_ID + "=" + song.getId(), null);
 }