How to store large blobs in an android content provider?

后端 未结 3 1503
自闭症患者
自闭症患者 2020-11-30 04:19

I have some large files (images and video) which I need to store in a content provider. The android documentation indicates...

If you are exposing byt

3条回答
  •  我在风中等你
    2020-11-30 05:08

    Android provides the helper method openFileHelper() that makes implementing the openFile() method very easy. All you have to do, to use this method, is to provide the location of the file in a column named “_data“.

    @Override
    public ParcelFileDescriptor openFile(Uri uri, String mode)
          throws FileNotFoundException {
       if (URI_MATCHER.match(uri) != PHOTO_ID) {
          throw new IllegalArgumentException
                ("URI invalid. Use an id-based URI only.");
       }
       return openFileHelper(uri, mode);
    }
    

    Click here for detail

提交回复
热议问题