CustomTabIntent:ActivityNotFoundException:找不到处理Intent的Activity

时间:2016-12-14 07:13:37

标签: android performance android-intent webview uiwebview

我试图从CustomTabIntent中的assest文件夹加载一个html文件但是我得到了日志" android.content.ActivityNotFoundException:没有找到处理Intent的活动{act = android.intent.action.VIEW dat = "

  private void loadHtml() {
        InputStream is = null;
        try {
            is = getAssets().open("demo.html");

            int size = is.available();

            byte[] buffer = new byte[size];
            is.read(buffer);
            is.close();

            String str = new String(buffer);
           // String str = "https://www.google.co.in";
            CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
// set toolbar color and/or setting custom actions before invoking build()
// Once ready, call CustomTabsIntent.Builder.build() to create a CustomTabsIntent
            CustomTabsIntent customTabsIntent = builder.build();
// and launch the desired Url with CustomTabsIntent.launchUrl()
            customTabsIntent.launchUrl(this, Uri.parse(str));


        } catch (IOException e) {
            e.printStackTrace();
        }
    }

它可以正常使用网址,但是当我们尝试使用资源时,它就无法正常工作。

0 个答案:

没有答案