Code example for ContentResolver

Methods: insertquery

0
        values.put(MediaStore.Audio.AudioColumns.YEAR, song.getYear());
        values.put(MediaStore.MediaColumns.DATA, songFile.getAbsolutePath());
        values.put(MediaStore.MediaColumns.MIME_TYPE, song.getContentType());
        values.put(MediaStore.Audio.AudioColumns.IS_MUSIC, 1);
 
        Uri uri = contentResolver.insert(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, values);
 
        // Look up album, and add cover art if found. 
        Cursor cursor = contentResolver.query(uri, new String[]{MediaStore.Audio.AudioColumns.ALBUM_ID}, null, null, null);
        if (cursor.moveToFirst()) {
            int albumId = cursor.getInt(0);
            insertAlbumArt(albumId, downloadFile);
        } 
        cursor.close();
    } 
 
    public void deleteFromMediaStore(DownloadFile downloadFile) {
        ContentResolver contentResolver = context.getContentResolver();
        MusicDirectory.Entry song = downloadFile.getSong();
        File file = downloadFile.getCompleteFile();