使用知乎的Matisse遇到的坑

2017-07-19  本文已影响0人  我才是张雷

Matisse集成及属性参考Matisse

使用相机必须指定

 Matisse.from(SampleActivity.this)
  .capture(true)
  .captureStrategy(new CaptureStrategy(true, "com.thunder.sample.fileprovider"))

manifest里必须指定provider

 <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="com.thunder.sample.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths_public"></meta-data>
</provider>

res里新建个包xml里新建个file_paths_public.xml文件

<paths>
    <external-path
        name="my_images"
        path="Android/data/com.thunder.sample.fileprovider/files/Pictures"/>
</paths>

注意:这三个里面的com.thunder.sample.fileprovider这值是一致的

上一篇 下一篇

猜你喜欢

热点阅读