Code example for ContentResolver

Methods: openInputStream

0
       ContentResolver res = context.getContentResolver();
        Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);
        if (uri != null) {
            InputStream in = null;
            try { 
                in = res.openInputStream(uri);
                return uri;
            } catch (FileNotFoundException ex) {
                // The album art thumbnail does not actually exist. Maybe the user deleted it, or 
                // maybe it never existed to begin with. 
                return getArtworkUriFromFile(context, song_id, album_id);
            } finally { 
                try { 
                    if (in != null) {
                        in.close();
                    } 
                } catch (IOException ex) {
                } 
            } 
        } 
        return null;