0

こんにちは、CSV Excel Pdf のようなエクスポート ボタンを備えたデータ テーブルを使用している Asp.net に Web サイトがあります。

サイト用の WebView Android アプリを作成しました。しかし、エクスポート ボタンをクリックすると、アプリがクラッシュします。

ここに私のダウンロードコードがあります

 myWebview.setDownloadListener(new DownloadListener() {
                @Override
                public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
                    Intent i=new Intent(Intent.ACTION_VIEW);
                    i.setData(Uri.parse(url));
                    startActivity(i);
                }
            });

これがアプリのクラッシュレポートです

android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=blob:http://192.168.43.1/bb78f8da-62b4-4d4e-83a6-683f3a167f25 }
    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1816)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1525)
    at android.app.Activity.startActivityForResult(Activity.java:4396)
    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:767)
    at android.app.Activity.startActivityForResult(Activity.java:4355)
    at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:754)
    at android.app.Activity.startActivity(Activity.java:4679)
    at android.app.Activity.startActivity(Activity.java:4647)
    at in.gov.Example.MainActivity$1.onDownloadStart(MainActivity.java:78)
    at com.android.webview.chromium.Ap.onDownloadStart(WebViewContentsClientAdapter.java:485)
    at org.chromium.android_webview.AwContentsClientCallbackHelper$MyHandler.handleMessage(AwContentsClientCallbackHelper.java:25)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:165)
    at android.app.ActivityThread.main(ActivityThread.java:6375)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:883)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)

この問題を解決するのを手伝ってください。私は最も感謝します。

4

1 に答える 1

0

表示したいデータの種類のインテント フィルタを宣言したアプリがありません。アクティビティが見つからない場合は、そのインテントの start アクティビティを呼び出すときに try catch で例外を処理する必要があり、playstore でそのアプリを検索できます。さらに、u が呼び出している URL は、その html、pdf、または csv のいずれを使用するかを定義しません。 Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://site")); startActivity(browserIntent);

try catch ブロック内

于 2019-03-10T07:38:25.920 に答える