pdfのダウンロードについて

892 views
Skip to first unread message

大沢直樹

unread,
Aug 21, 2011, 11:01:17 AM8/21/11
to android-g...@googlegroups.com
はじめまして、奥田と申します。

webviewにてpdfをダウンロードし、完了後,intentしようとしています。

        webView.setDownloadListener(new DownloadListener() {
          @Override
          public void onDownloadStart(String url, String userAgent,
            String contentDisposition, String mimetype, long contentLength) {

            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setType(mimetype);
            intent.setData(Uri.parse(url));
            startActivity(intent);
          }
        });
を組み込み、
            <intent-filter>
                    <action android:name="android.intent.action.VIEW"/>
                    <category android:name="android.intent.category.DEFAULT"/>
                    <data android:mimeType="application/pdf"/>
            </intent-filter>
を実装しましたが、ループするばかりで処理がうまく行きません。

助言やアドバイスをいただけると幸いです。

以上、よろしくお願いいたします。

fuku

unread,
Aug 23, 2011, 5:01:12 AM8/23/11
to 日本Androidの会
日本Androidの会 鹿児島支部 福吉と申します。

WebViewを使用してダウンロードのところを作ってみたのですが、
ループするところは確認できませんでした。

そこで、いくつか確認させてください。

1.
<action android:name="android.intent.action.VIEW"/>

<action android:name="android.intent.action.MAIN"/>
ではないですか?どこにフィルタを設定しているのか分かりません。

2.
onDownloadStartの中でログを出してみたのですが、
ログの出力がないので呼ばれていない感じですが、他にも設定が必要ですか?

3.
ループはどのようにループするのでしょうか?

以上、よろしくお願いします。
Reply all
Reply to author
Forward
0 new messages