open pdf in popup android

不问归期 提交于 2020-01-11 13:32:47

问题


I am developing an Android app, where I need to open my pdf file in a popup window. My code is:

ImageView brobutton=(ImageView)layout.findViewById(R.id.imageView3);
brobutton.setOnClickListener(new OnClickListener() {
                                                   }
});

I already have developed an app to open pdf in emulator with this code:

final String googleDocsUrl = "http://docs.google.com/viewer?url=";
WebView mWebView=new WebView(SubProducts.this);                                         mWebView.getSettings().setJavaScriptEnabled(true);
WebSettings webSettings = mWebView.getSettings();
webSettings.setPluginState(PluginState.ON);
mWebView.setWebViewClient(new WebViewClient() {
    public boolean shouldOverrideUrlLoading(WebView view, String url){                                                          
        view.loadUrl(image_urlpdf);
        return false; // then it is not handled by default action
    }
});
mWebView.loadUrl((googleDocsUrl + image_urlpdf));

under the onclick of button I need to open my pdf.Any one suggest me with good idea. Thanks in advance.


回答1:


You need to modify your app to open PDF. Either pass some flag using intents to alert that your app need to open popup for showing PDF.

Check this thread for how to show activity as dialog Android Activity as a dialog




回答2:


You could load your PDF file in the custom dialog. Tutorial for creating the custom dialog - http://www.mkyong.com/android/android-custom-dialog-example/



来源:https://stackoverflow.com/questions/15743179/open-pdf-in-popup-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!