• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Help with JS on sdcard

Stuck on this one...
Have an android app that copies a js file to app folder on sdcard and also writes an html file based on user input to same folder. All is great on emulator but on an android device the js does not seem to be working on the sdcard. I use an onclick tied to a button to bring up the html file using webview loadurl which loads it fine but when the js link trigger is touched it seems the js function is not firing right.
In the emulator it works but on a droid device the js function does not give the same behavior. If I pull the program directory off the sdcard with the 2 files and use a browser the process is working. I also have js and html on the main app side which is working correctly. It is just on the sdcard that the js does not seem to be firing but only when on the droid device which is a android phone, in the emulator everything is working .
It would be nice to get some info from eclipse on this but I'm not get nothing as far as errors or anything when the process goes south on the sdcard side and I'm using the phone to debug.
Any ideas on how to get an error or why this may be miss-behaving?????

Edit:
So I decided to try and use the app's files folder to see if it was an sdcard issue and no in the app's directory I'm still having issues running this. I set it as my first activity and it loaded but still having js problem. The only difference between this and the original app's start activity is the start folder. The webview loads from the assets folder and all works fine but outside of that folder the js gets screwy. I'm using a 2.3.5 android system to test with.
Can you not run js outside of assets folder??
My next step is to re-path the js file in the html I use in my code so it looks at the assets folder for it. Maybe some permissions issues there? I simply want to run an html file that uses js. The html file is user created and I can create it anywhere but it seems that there are limitations to running js. A simple fix would be to write the user created file to assets but that was a no go because I can't write to the assets folder.
The process is the app is installed, the user logs in , enters some text and clicks submit, and then the program creates a file with the entered text and some already existing html that refers to the js, then the user can click a button to open the created file. All works fine on the emulator but on the test phone the js craps out. No messages to help me locate the issue it just will not work right. As far as I can tell it loads the js but with no troubleshooting I can't be sure. In any case the process works first in pc browser, second in emulator, and in phone except when the file is outside of assets the js will not run right. I guess I also need to take a look at opening a new webview inside another webview although it is doing fine in the emulator.

Ok , figured this out. My app needed at least one return for Android to show the user created file. A one liner with out a return wouldn't show on android. It did show on all other tests so it took me a while to pound out the why. Still wished eclipse had more js feedback on js issues.
 
Back
Top Bottom