Display PDF file stored in google drive to WebView | بلاگ

Display PDF file stored in google drive to WebView

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

My app looks like: My app screen

and this is my code for webview:

private String myPdfUrl = "https://drive.google.com/open?id=1rquwQNdXeds39Rlb32isX3bjYghHitCV";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    init();

    webView.getSettings().setJavaScriptEnabled(true);

    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
            view.loadUrl(myPdfUrl);
            return true;
        }
    }
    );
    webView.loadUrl(myPdfUrl);

}

My problem is: when I run in Genymotion with API 19,21, It works. But in API 25, The WebView show only white screen.

My app screen 2

asked 2 mins ago
Phúc Nghi Lâm

...
نویسنده : استخدام کار بازدید : 8 تاريخ : سه شنبه 24 بهمن 1396 ساعت: 8:50