Open HTML file stored outside the asset folder in a webview - android

Hi i am new to android development and have been searching everywhere on the internet for how to display simple html file on webView. Almost everybody is using the code:
webView.loadUrl("file:///android_asset/index.html");
which works fine ONLY when the html file is inside the asset folder of the android app!. I am trying to do something that loads the html file from another drive and have searched everywhere to find this solution to no avail. Please help me out. Thanks in advance.

Related

How to add a particular CSS for particular app

I have a live website which I want to show in my app with WebView. But also I want to add a css file in my website which will only work if This particular app load the website. Otherwise that css will not work.
Is this possible? If possible please anyone can tell me how to do that?
Put your index.html of your Website and the css file in the assets folder of your Android project. Modify your index.html so it will load the css file by adding a link to it.
Then when loading the WebView, just load the index.html from your assets folder and you are done. Like so: webView.loadUrl("file:///android_asset/index.html")

How to display PDF in webview from assets folder android

I surfed a lot for this solution but everywhere I got same solution i.e. either use Intent and pass it to default/installed PdfReader applications, Other one is to use gview from googleDocs to load Pdfs online.
But my question is how can view my pdf offline in webview i.e. if user click on list of pdf in my application don't go to other application or google/gview .
I tried passing assets folder path but not working getting message in webview that "webpage is temporarily down or move permanently."
I also tried this link.. which describes to use pdfViewver.jar but that lib. has it's own issues that needs to be fixed.
any help will highly appreciated
But my question is how can view my pdf offline in webview
You can't. WebView cannot display PDFs on its own.

How to access whole HTML project with Android project?

I have a task to access whole HTML project (with CSS, etc.) in my android project. Can anyone help me on that? I googled about it, but all I found was "Webview", which I already know.
I a\want to know where I can put the CSS files, html files in my Android project and how can I manage whole HTML project? (i.e. transition from one page to other, etc.) Please suggest me some good document or tutorial if you know about this. If webview is the only way, how can I switch from one page to another? Because all I know is to use
myWebView.loadUrl(Uri.fromFile(www.website.com);
I have also managed to load a single html file from sdcard.
myWebView.loadUrl(Uri.fromFile(
new File(Environment.getExternalStorageDirectory()
.getAbsolutePath() + File.separator + "index.html"))
.toString());
But I don't understand how I can proceed for a whole project!
Any help would be highly appreciated.
You need to use webView that is for sure.
For that you can put you whole HTML (css,js,html) in asset folder and load local index.html in webview just like.
webView.loadUrl("file:///android_asset/html/index.html");
And webview will load whole local site. .css and js will be directly handle by webview it self even hyperlink will also work.
You can also customize you webview and listen js call for making hybrid app. But this is only for hybrid app.
Hope this help.

How to open local PDF file in PhoneGap (android)

I'm trying to open a local PDF file stored in the sdcard. I tried everything possible but nothing seems to work.
I tried to open the pdf using the anchor tag with external and _blank attribute.
I as well tried to "WebIntent, an Android PhoneGap Plugin". But was not able to succeed. I'm sure i have missed something in the manifest xml file. I'm not more into backend development. Any help will be appreciated.
Thanks in advance
Here the answer :
http://giovesoft.blogspot.com/2011/08/download-and-open-pdf-with-phonegap.html#more

HTML embeded in android

i have try to load swf in android.i use this :
but,i think that this is recommend to store SDCARD first and trying to display?
my question is, my point of view is correct or wrong?
i have try by android_asset but not get success.
First of all, I think you should use webview control to load SWF file. (if you have not done above).
Using webview, You can load swf file in any of following way,
Android Asset.
From SD Card.
URL from web.

Categories

Resources