我想开pdf file的chrome custom tab,它通过使用此代码工作正常
CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
CustomTabsIntent customTabsIntent = builder.build();
customTabsIntent.launchUrl(this, Uri.parse("https://docs.google.com/viewerng/viewer?url=" +pdflink));
Run Code Online (Sandbox Code Playgroud)
但问题是,如果用户从应用程序设置中禁用了 chrome,并且没有其他浏览器,它就会崩溃。那么如果它被禁用,我如何在 chrome 自定义选项卡中打开它。
提前致谢。
这是出现在 logcat 中的异常。
Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://docs.google.com/... (has extras) }
Run Code Online (Sandbox Code Playgroud)