i have downloaded the phonegap example from its website.but it doesn't run.i can't find the reason.help me to get the solution please.when i run it shows
"The Web page at file:///andriod_asset/www/index.html could not be loaded as:
The requested file was not found.www/index.html"
I tried with three "///" instead of four, it worked for me. Give a try
super.loadUrl("file:///android_asset/www/index.html");
You've spelt android wrong here:
HERE!!!
file://>>>>>>andriod<<<<<<_asset/www/index.html could not be loaded as: The requested file was not found.www/index.html"
Try out:
file:///android_asset/www/index.html could not be loaded as: The requested file was not found.www/index.html"
Best of luck!
Just a quick comment for other's getting to this same problem, who doesn't have the spelling error. My new app using PhoneGap 0.9.4 was giving this same error box. The solution was to rename phonegap.0.9.4.js and phonegap.0.9.4.jar to just phonegap.jar and phonegap.js. After that it loads up.
You and I did the exact same thing -- flipped the i and the o in android.
Change "andriod" to "android" and it should work :)
I was using capitals for the folder WWW which was causing the same error to be thrown. I have now changed it to lowercase which works well now.
Related
I am working with this http://www.survivingwithandroid.com/2013/05/build-weather-app-json-http-android.html tutorial to learn how use weather services in my app. I run this tutorial and it works fine. But I've got one problem. Can't load icons. Logcat error is
java.io.FileNotFoundExeption: http://openweathermap.org/img/w/ at libcore.net.http.HttpURLConnectionTmpl.getInputStream(HttpURLConnctionTmpl.java:186)
When I open this link in Chrome I can see the image so I don't know why it can't be found.
code is there https://github.com/survivingwithandroid/Surviving-with-android/tree/master/WeatherApp
Error in line 87 of file "WeatherHttpClient.java"
facing the same issue just change your url like bellow and its working fine
https://openweathermap.org/img/wn/50d#4x.png
You're trying to load a directory as file stream. Not sure why this should cause a FileNotFoundException but it's worth trying with the URL: http://openweathermap.org/img/w/<one-of-the-files>.png
At least the file should be possible to open.
add .png file ext
example
con = (HttpURLConnection) ( new URL(IMG_URL + code +".png")).openConnection();
https://github.com/guidosabatini/phonegap-plugins/tree/master/Android/WaitingDialog
I found this Waitling Dialogue Plugin for Phonegap. But i don't know how to use this, i mean where to put the files?
So please help me to solve this issue.
Download and put the WaitingDialog.java inside main package in src.
Then download and include the WaitingDialog.js file in your in the html file. Something like the following:
Then call necessary functions:
// To SHOW a modal waiting dialog
window.plugins.waitingDialog.show("Your dialog text");
// To HIDE the dialog
window.plugins.waitingDialog.hide();
[I haven't tested, but hopefully it will work.]
Alternative Solution:
If you are using jQuery Mobile then another solution can be to use jquery.mobile.utils to show the loader.
Download and include the jquery.mobile.utils.js file in your html file. Then call necessary functions like below:
// Params: jqm theme swatch, and message text
$.mobile.utils.showWaitBox("a", "Hang on while I do work...");
// ... some time later...
$.mobile.utils.hideWaitBox();
[This one is tested and works fine.]
The is a weird one:
Ref
Drawable image = getResources().getDrawable(R.drawable.mypic);
At first everything was running fine, except the image (which I draw) was missing some shade. So I edit my image away from eclipse and then replace the old mypic.png with the new one. But eclipse refused to see the new image, as if it had already cached the old one and was using that. So I change from mypic.png to mypic1.png, then the line of code kept returning image as null. So I gave up and changed the image name back to mypic.png (I figure I'd let it use the cached one), but eclipse kept on returning image = null.
Any help with this is greatly appreciated.
after modifying png images do F5 on res folder so that eclipse see the the new image
What finally worked for me is this: instead of doing a hot replace and then F5, I removed the images manually first. Only then, I add the new edited version of the images. For some reason eclipse saw the image then. I am still baffled at the problem and doubt it is reproducible. I am including this here in case someone else somehow gets the same problem. F5 didn't work; cleaning didn't work; restarting eclipse and the emulator didn't work. It's all magic to me.
I know that there are a lot of questions about to load HTMl-pages into WebView.
What am I doing? I just put down the 1.html in assets folder in android-project and use
myWebView.loadUrl("file:///assets/"+selectedItem+".html");
where
selecteditem
is data from intent. As result I get the message in WebView that:
file:///assets/1.html was not found.
UPD: sorry, I found the solution. the correct path should be the follow:
myWebView.loadUrl("file:///android_asset/"+selectedItem+".html");
The correct path is file:///android_asset/1.html
I am not sure,but it may work:
webView.loadUrl("file:///android_asset/1.html");
Know more about the same type of mistake: Loading existing .html file with android WebView
I have a WebView that I'm using to open some files stored in the assets/ directory of my project. It works fine for most of the files, but there's one in particular (and I'm sure others I haven't found) that it just will not open.
The file I'm having problems with is named:
"assets/ContentRoot/Photos/XXX Software Logo - jpg - 75%.JPG"
When I pass it to WebView, and it shows the error page, it shows it as:
"file:///android_asset/ContentRoot/Photos/XXX%20Software%20Logo%20-%20jpg%20-%2075%.JPG"
I then tried running URLEncoder.encode() on it and got the error page with the URL presented as:
"file:///android_asset/ContentRoot/Photos/XXX+Software+Logo+-+jpg+-+75%.JPG"
Neither of these URLs were able to open the file (and they both look okay to me). Anyone have any ideas?
UPDATE: If I encode the % by hand (using %25, as commonsware.com suggested) then it loads the image, but it tries to parse it as text, not as an image, so I just get a lot of (basically) garbage.
Also, referring to the image in an HTML document with a relative URL isn't working (probably because it's not being parsed as an image?):
<img src="../Photos/XXX%20Software%20Logo%20-%20jpg%20-%2075%.JPG" />
<img src="../Photos/XXX%20Software%20Logo%20-%20jpg%20-%2075%25.JPG" />
Okay, after spending way too long on this, I've figured out what's going on. Basically, if images stored in the assets/ directory contain a space (e.g., " ") in their file name, they won't render as images.
myWebView.loadUrl("file:///android_asset/testimage.jpg");
works fine. However,
myWebView.loadUrl("file:///android_asset/test+image.jpg");
just throws a not found error and
myWebView.loadUrl("file:///android_asset/test image.jpg");
// and
myWebView.loadUrl("file:///android_asset/test%20image.jpg");
show it improperly displayed (as text... see screenshot in question).
This unexpected behaviour is present on (at least) 1.5, 1.6, and 2.0 and I filed a bug report.
Try getting rid of the % in the filename. Or, escape it as %25.
I would guess that WebView only understands text related content types so it faithfully treating your JPG as base64 encoding, decodes and displays resulted gobble-goop as text. I don't really know if it's possible to set content type for WebView but as workaround you can try to throw img tag inside html tag and load resultet page. Also you probably can only use WebView#loadDataWithBaseUrl