プロバイダを使用して、負荷のテキストファイルERR_UNKNOWN_URL_SCHEMEときのmanifest.xmlにfileprovider
<!-- File Provider -->
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.example.test.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
リソースファイルfileprovider
Uri uri = FileProvider.getUriForFile(context, context.getApplicationContext().getPackageName() + ".fileprovider", file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri, "*/*");
intent.startActivity(intent);
の
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
</paths>
使用10
リファレンス:here
説明: 私は開いている画像、テキストファイル、PDFファイル、このプロバイダを使用することはできません。 ファイルのテキストファイルを開くと、ERR_UNKNOWN_URL_SCHEMEが表示されます。 私は画像やPDFを開くと、その何もあなたの意思に「FLAG_GRANT_READ_URI_PERMISSION」フラグを追加する必要が何
uri.toString()の値を教えてください。 – greenapps
そしてfile.getAbsolutePath()。 – greenapps
/ストレージ//0/KOOPSv3Sales/KOOPSv3Salesメッセージの添付ファイル/ 29ca8aed.txt –