I have an android app that includes a WebView. When a user clicks on a link to a pdf nothing happens in the app. After some research it seems that the WebView doesn't support showing PDF files out of the box.
I've looked at several solutions on SO and all of them seem to use deprecated code.
What is the best way to accomplish this? I would add that I am fine with another app opening the pdf (it doesn't have to display directly in my app).
Edit: Clarification
Due to security concerns, pointing our pdf url to docs.google.com is not allowed.
Unfortunately, Android doesn't support viewing PDFs in a WebView. But still, you can do it in some other way. Actually, you can use the Google Docs. We will be loading the PDF in the Google Docs.
Here is the Code Snippet which you can use to open the PDF-
String myPdfUrl = "http://example.com/awesome.pdf";
String url = "http://docs.google.com/gview?embedded=true&url=" + myPdfUrl;
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(url);
That's all. Your Pdf will be open in the Google Docs.
Related
I want to make a samsung smart tv app with tizen.
I've made an webpage using springboot.
I tried making the app using that webpage codes I made, but I've got to know Tizen doesn't support java but html, css,and javascript only.
So I used meta http-equip="refresh", and let index.html go to my webpage url,
but there were long loading time, and ugly ui for a waiting page..
also remote control's pointer was weird. (not focusing on a certain button, but there is a cursor)
is there no way to solve this problem?
I've tried to find a way but I couldn't. please help me...
It seems that you are making a redirect to your website (hosted in internet).
Maybe would be better starting reading the basic concepts about Samsung Smart TV apps here
If you try to open external content (hosted websites) into your app the TV will use its web browser to open it.
As the title states, I am wondering how to open the Android image gallery directly from my app. Every single package that is out there, including react-native-image-picker, react-native-image-crop-picker, and yes, even Expo's expo-image-picker all open the "Recents" area!
Opening the gallery MUST be possible, since apps like Whatsapp, Tinder, Facebook, etc. all have this functionality when choosing pictures.
Such a simple functionality - and yet after a month of on and off search I have come up with no solution. Can anybody provide me with a way to do this? Or guide me in the correct direction? At this point I am prepared to write native Android code or custom React Native to get this to work.
i found this library
react-native-multiple-image-picker
it will open camera roll not recent file
i m trying to show a pdf file from my google drive link sush as
https://drive.google.com/file/d/1H7GwpxteH-w3rSaQzd91sc15xNW5lFbG/view?usp=sharing
in android studio using the android-pdf-viewer. but this dependency works only with an uri with .pdf in the end. any way to solve this problem??;(
when i was using the android-pdf-viewer package i faced 2 problems: cant display a pdf from an url and the huge size of the generated apk.
i searched a lot for a good alternative but nothing found.
thats why i dispayed my pdfs in a webview. so it was fine.
One last problem was the long time to upload and display a google drive link in the webview. ;(
Please, is there any way to force WebView to play html5 embedded vids? I spent two days tempting it (from just enabling js and plugins with hardware acceleration to using html5webview class) and made video tag working, but embedding with iframe only shows me preview.
Any suggestions, please?
Does it play if you click on it manually? There are all sorts of things that may go wrong with HTML5 video on the internet, on Android you also have to take into account the various permissions.
Try this first:
Load the webpage in a browser - does it work?
Load the webpage in the browser on the device, does it work?
Load the webpage in the webview, does it play when you click on it?
There should be an auto play property on the webview, but I know that one IOS at least that one is ignore and the video won't play until you click it.
Due to lack of work & knowledge, I dont know the APIs by using which I can build Images gallery.
Please suggest the Servlet/JSP APIs to display Images Gallery like Facebook / Orkut.
Generally image galleries are done using JavaScript not using Java. Your Servlet/JSP api will provide links to your images and a JavaScript will be used to show them as gallery. Here is a ton of jQuery plugins(There are more for other libraries and some with out using any libraries) online.
In that case you shouldn't code it yourself :). Here you have an open source project called TriArctic which does just that :)