Code example for FileNotFoundException

0
    @Override 
    public android.os.ParcelFileDescriptor openFile(android.net.Uri uri, java.lang.String mode)
            throws java.io.FileNotFoundException {
 
        Pair<UUID, String> callIdAndAttachmentName = parseCallIdAndAttachmentName(uri);
        if (callIdAndAttachmentName == null) {
            throw new FileNotFoundException();
        } 
 
        try { 
            File file = dataSource.openAttachment(callIdAndAttachmentName.first, callIdAndAttachmentName.second);
 
            return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
        } catch (FileNotFoundException exception) {
            Log.e(TAG, "Got unexpected exception:" + exception);
            throw exception;
        } 
    } 
 
    Pair<UUID, String> parseCallIdAndAttachmentName(Uri uri) {
Contextual code suggestions in your IDE  Get Codota for Java