CSS, Javascript inside the assets folder in Android Studio, when loading a web page?


I have a doubt about the possible use of this method, when trying to load a web page from a server, example: "www.mitiendafavorita.com", through a WebView in Android Studio, this page is loaded together all your css and js, increasing the amount of download.


There is a way to load a web page, but within the code of that web page, the link addresses of css and js, go to a local fixed folder within the studio android application " assets "so that they do not have to be downloaded each time the website is loaded?

IN ANDROID STUDIO: if I use this method, I must necessarily have the css files, and js in the same folder so that it works

< myWebView.loadUrl("file:///android_asset/ejemplo.html");>

and example.html should have in its code structure:

<link rel="stylesheet" type="text/css" href="extra.css">

and everything works great, because the css is in the same html folder. Both inside the assets folder of the android application


if I load a page with the Webview, example: www.mitiendafavorita.com, how could I use the css and js hosted in the local "assets" folder of the application?

I already tried the following and it did not work:: (

<link rel="stylesheet" type="text/css" href="file:///android_asset/extra.css">

Many thanks to the people who could help me: '(

asked by Alv Raf Alc Mir 19.11.2018 в 02:27

0 answers