Android :: Loading JS / CSS Files In Assets Within HTML
Jul 8, 2010
I'm loading html into a webview from my assets folder, works no problem. In my second experiment I've loaded HTML from a database (after pulling from remote source) and displayed in a webview (also no prob). Now I'm trying to change the baseref inside the html to have all JS and CSS references point to source files under assets. This part doesn't seem to work. I get warnings from the web console that it can't load these files due to security issue.
Now I've resorted back to a content provider and overriding openFile (and setting base ref with content://...) but now I'm hitting another problem with the JS and CSS files in assets being compressed. Can load html from assets but loading JS, CSS from within that HTML is another story. Before I dig deeper, am I over-complicating this?
View 3 Replies
Jun 30, 2010
I'm trying to load a html page from the assets directory. I tried this, but it fails. I don't really get any telling errors in LogCat...
View 1 Replies
View Related
Oct 17, 2010
I have a webview in my activity and loaded contents for webview by following:
CODE:..................
In description.html i have a reference for another html file located in the same place by following:
CODE:..................
This was working absolutely fine in emulator but when i run it on my Galaxy S mobile, hyperlink does not work fine. Kindly help me. Is there any permission i am missing or something else?
View 1 Replies
View Related
Sep 26, 2010
I have a main page (main.html) in the assets folder that I am displaying with:
webview.setWebChromeClient(new MyWebChromeClient());
webview.getSettings().setJavaScriptEnabled(true);
webview.addJavascriptInterface(new VersionCallbackScript(), "demo");
webview.loadUrl("file:///android_asset/main.html");
and I want to put a link in the document to another html file in assets folder. When I similiarly put in the tag:
<a href="file:///android_asset/secondpage.html">Touch here for page 2</a></font></h4>
and touch it in the client, the screen loads a blank page.
likewise, I want to have a table of contents that isA ListView and uses loadUrl with an html page suffixed with an anchor. I tried and it is not working
String anchor = "subsection1";
webview.loadUrl("file:///android_asset/main.html" + "#" + anchor); this construct is not working either.
View 1 Replies
View Related
May 21, 2009
I'm trying to load a video file from assets folder, but MediaPlayer or VideoView still crashes. Somebody has an idea?
View 4 Replies
View Related
May 21, 2009
How do I load the image dynamically through the code? If its unclear, I mean, I want to load image files by name based on the condition in the code. If I use images as resources, the image names have to be hard coded. This is unacceptable to me. If I load image in a webview (with image src path dynamically), the time it takes to load is unacceptable to me. Can anyone suggest any other way to load the images dynamically?
View 2 Replies
View Related
Nov 4, 2010
I am working on an android app. Where i need to parse some plist files from assets folder. I do understand how to use assets in android but now problem is that file sizes are more than 1MB and so android gives error Data Exceeds UNCOMPRESS_DATA_MAX (2183588 vs 1048576). how to access such larger files from assets? Also I cant reduce a file into small buffers because i am just sending it to "DocumentBuilder.parse(in)" as a whole so can not use buffer. The error is on line: Document doc = db.parse(in).
View 1 Replies
View Related
Nov 2, 2010
I have one html file and I want to load that html file in view for loading ping images. I was doing:
android:background="@drawable/tips"
This in xml file but how to load html file in view?
View 8 Replies
View Related
Jan 19, 2009
How to load simple html file present in sd mmc card from web browser. It is mentioned in the net that due to security reasons this is not allowed. Is there any way to access the file from sdcard? Tried modifying private String homeUrl =
"file:///sdcard/index.html";
in BrowserSettings.java file but browser throws an error "could not be loaded".
View 4 Replies
View Related
Sep 29, 2010
This should be very simple, but I can't find the answer anywhere. How do I load an html file (which I assume I keep in res/raw folder) into a webview?
neither mWebView.loadUrl("file:///raw/about");
or
mWebView.loadUrl("file:///raw/about.htmal");
works.
What's the correct syntax or arrangement.
View 3 Replies
View Related
May 8, 2012
how to program/write code on a "webview" in Android for loading a html file?
View 2 Replies
View Related
Oct 2, 2010
I am using a text file in assets folder in Android. I would like to change the data inside that text file dynamically. I am trying to open the file as follows,
CODE:...........
But it generating the error that "java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed". please help me to edit that file.
View 1 Replies
View Related
May 18, 2010
I'm going crazy, I created a file object, so it can be read with ObjectInputStream, and I placed the assets folder.
The method works with a file smaller than 1M, and give error with larger files.
I read that is a limit of Android platform, but I also know that can be "easily" avoided.
Those who have downloaded the game Reging Thunder, for example, can easily see that in their assets folder is a file 18.9M large.
This is my code ...
now I have an uncompressed file and I can use it without worrying about the error "This file can not be opened as a file descriptor; it is probably compressed"
This function works well with files smaller than 1M, with bigger files return an
java.io.IOException on line "ObjectInputStream ois=new ObjectInputStream(is);"
why?
View 5 Replies
View Related
Jul 8, 2009
I have put HTML document into a string variable and load it by using webView.loadDataWithBaseURL(null, htmlString, "text/html", "utf-8", null).
After that, I tried two ways and want to execute javascript function "exec()" by using
1. webView.loadDataWithBaseURL(null, "javascript:exec()", "text/ html", "utf-8", null) -> This will overlap the content of previous "htmlString" and shows "javascript:exec()" on the screen.
2. webView.loadUrl("javascript:exec()") -> There will be "Can't find variable: exec line: ..." in Logcat
I have tried to output "htmlString" to a file located in sdcard, and tried to use webView.loadUrl("file:///sdcard/xxx/a.xhtml") + webView.loadUrl("javascript:exec()").
And...it fails again! how to execute javascript function after loading html content by "loadDataWithBaseURL"?
View 2 Replies
View Related
Jun 8, 2010
Is there a way to write to the /assets direcory and save arbitrary files to it? I am intending to download a HTML page which should be updated from time to time. If no network connection is available it should be taken out of the assets directory. I know I can reference fils in here using the file:///android_asset/ base URL, but can I write to it, too?
View 2 Replies
View Related
Jun 6, 2010
Does an ebook reader exist for Android yet that will open HTML files? I can't find one.
View 4 Replies
View Related
Sep 21, 2010
Some html files are in my sd card. I am using qualcomm surfs. By using adb shell commands or "adb shell am start -n com.android.browser/.BrowserActivity file://sdcard/example.html" how can i access or open that html files. Is there any method for accessing sd card files.
View 4 Replies
View Related
Nov 1, 2010
Due to my little knowledge in Java programming, I've wondered if I'm able to display local html files in my application? (And when yes could you please give me a reference.)
View 2 Replies
View Related
Nov 20, 2009
I wanted to be able to use my Google bookmarks on my Droid. I found a program that imports them to the phone, but it replaces everything and I didn't want all those bookmarks in my browser. I exported my Google bookmarks to a HTML file and stored it on my SD card in the download folder and named it bookmarks.htm. I then went into the Droid browser and typed the following URL: content://com.android.htmlfileprovider/sdcard/download/bookmarks.htm
I then created a bookmark of the link.
Now, I open my browser, click on the bookmark, and all my Google Bookmark sites are displayed as links in order listed under their categories.
View 1 Replies
View Related
Oct 2, 2009
I am currently developing a dictionary application with voice database. I would like to know about the current Android limitation on the file size. I am using a self-provided sqlite database ( > 50mb ) . I tested that once the built .apk size exceeds ~30mb the app will not be installed onto the simulator (INSTALL_FAILED_ INSUFFICIENT _STORAGE). Could anyone confirm me that if up until now there is no way to embed such large size files in a single apk ( Aimed to sell at Google Market without requiring user to download datafile afterwards). Also, is there a limitation of 1,048,576 bytes for a single file in the assets folder ?
View 3 Replies
View Related
Feb 9, 2009
I would like my users to develop their own routines for image manipulation. Lets presume that a third party has written a class which implements one of my interfaces; public abstract class PixelBinaryFilter extends BinaryFilter{protected abstract int generatePixel(int p1, int p2);}
View 3 Replies
View Related
Oct 12, 2010
I have a .swf file and i want to open it into webview and also wanna play flash games loaded there in webview.
View 1 Replies
View Related
Nov 7, 2010
Question is there a way to play html and swf files offline? I have successfully updated my SGS to Froyo and flash works okay, but I would like to play html / swf files while not connected to the Internet. When I point my browser to local file, say file://sdcard/game.swf I get a message file not found. Anyone know a way how to do this?
View 7 Replies
View Related
Nov 22, 2013
I have one bitmore 1010 tablet with custom rom cyanogedmod, I delete some files from root directory and now the tablet is not load android os. I see only the bitmore image in screen and nothing else.
can I restore the image from android control v1.3.1?
View 1 Replies
View Related
Dec 19, 2013
Verizon Galaxy Note 3, up-to-date, stock ROM, not rooted.
I have a 64gb MicroSD card installed, and put a copy of my photography website on it. I find I am unable to figure out a way to open it in Google Chrome.
I used ES File Explorer's FTP function to begin with, to copy files from my website to the card, and this worked beautifully. When I click on the index.html file on the card, the only options offered are HTML Viewer and some text editors. Chrome is not an option (Chrome is the default browser for my phone). I can try "Open as" and choose Chrome, but get the same error message as below.
If I long-press the file, and select Properties, I can copy the (full) Path for the file, but when I paste this into Chrome's URL bar, it won't open:
Access to the file was denied "The file at file:///storage/extSdCard/PhotoWebsite/index.html is not readable. It may have been removed, moved, or file permissions may be preventing access"
I have searched quite a bit, and tried various addresses, including localhost, localhost/mnt, content:, etc., etc., but nothing seems to work.
Ultimately I want to have a Bookmark in Chrome where I can view my website offline when necessary, but this seems to be more complex than would appear necessary.
View 1 Replies
View Related
Nov 1, 2010
I have heavily edited the original text and instead of the how question I am posting the code that produces the effect I wanted, namely a floating menu on top that stays fixed as I scroll whatever is in the middle with a lower menu at the bottom of the screen. Ain't life sweet - Might even work on the iPhone as well.
Why I posted was like I said in the original question. I'm fiddling with creating the initial lay out for a "mobile" application for the disabled, have tonnes of data, dictionary files, icons for the purpose etc. I want to have the app running as HTML to make it as portable as possible, i.e. make it runnable on Android, Iphone, Maemo... whatever.
I got some hints by looking at the example at http://www.quackit.com/css/codes/css_floating_menu.cfm as well as a lot of trial and error and finally minor edits by a paid freelancer.
Below you can find some crude (to put it mildly) HTML/CSS (cut the CSS part and load a style instead in the HTML's you create for cleaner code) but for now, let's look at the prototype concept.
CODE:...........
You can see the working example on your Android device or in your Android emulator http://globability.org/webapp/aaa.html
Need to get the sound working though - but nearly there :)Links to the different web based version and thoughts behind application can be found on:
The project this application springs from can be found on [url] - Look under prototypes (it is the top one under the heading protypes).
View 1 Replies
View Related
May 13, 2010
I;ve been trying to create a custom button in android using this tutorial - http://www.gersic.com/blog.php?id=56
It works well but it doesn't say how to change the font size or weighting. Any ideas?
There was another question on here and the only answer was to use html styling but you can't change a font size in html without using css (or the deprecated font tag). There must be a better way of setting the pixel size of the font used on buttons?
View 1 Replies
View Related
Sep 21, 2010
I am working on some a application where I have to update some files present in assets / raw folder runtime from some http location.Can anyone help me to by sharing how to write files in assets or raw folder programmatically?
View 1 Replies
View Related
May 4, 2009
I want to display a fancy 'loading' image at my app's startup time.
The problem: my startup code is mostly GUI related, hence needs to run on UI thread.
Is there a way to do both - that is run UI-related code on UI thread while an image is displayed to the user?
View 8 Replies
View Related
Jun 14, 2010
CODE:..............
In this case 'i' is -1 meaning nothing read. Why would nothing be there if the file is there, the variable 'files' has the file as well. Do I need to do anything to the file I put into the Assets folder in get it to be readable? When I use a small text file it works. When I use a 10 meg file, it does not. (The 10 meg is a Sqlite database I need to install)
View 2 Replies
View Related