1.注册provider
<provider
android:authorities="xxx"
android:name="android.support.v4.content.FileProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/path"/>
</provider>
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="ssss" path="" />
</paths>
2.代码实现
Uri fileUri= FileProvider.getUriForFile(this,"xxx",filexx);
Uri uri =Uri.fromFile(filexx); //SDK_INT<24