我在我的项目中使用https://github.com/jhansireddy/AndroidScannerDemo这个扫描库。
当我捕获图像时,我进入D/skia: --- Failed to create image decoder with message 'unimplemented'
控制台并且捕获的图像未设置为Android P 中的图像视图。
同样,当我在Android Q 中测试相同的应用程序时,出现以下错误。
2020-02-05 11:32:23.668 9270-9270/? E/ReviewScreenImpl: onClickOKButton() - Fail to decode captured picture
有人可以帮助解决上述问题。
android android-manifest android-camera android-fileprovider
在我的应用程序中,我将 pdf 下载到下载文件夹,并尝试使用以下代码打开。
String FileName="CardsDecks";
File imagePath = new File(this.getFilesDir(), "Download");
File newFile = new File(imagePath, FileName+ ".pdf");
Uri contentUri = FileProvider.getUriForFile(this, "com.cards.mycards.fileprovider", newFile);
Intent intent =new Intent(Intent.ACTION_VIEW)
.setDataAndType(contentUri, "application/pdf")
.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Intent intent1 = Intent.createChooser(intent, "Open File");
startActivity(intent1);
Run Code Online (Sandbox Code Playgroud)
清单文件中的提供程序定义
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.cards.mycards.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
Run Code Online (Sandbox Code Playgroud)
provider_paths.xml
<paths>
<files-path name="CardsDecks" path="." />
</paths>
Run Code Online (Sandbox Code Playgroud)
该应用程序仅显示用于打开文件的驱动器 pdf 查看器和 word 选项,而不显示手机中的 pdf 查看器。
当我单击驱动器 pdf 查看器时,它会立即打开和关闭。我已经检查了下载文件夹中的文件,文件存在于其中,其中包含内容。
请帮助以上。