For starters, I am not a programmer, my wife is making me learn how to program for Android because she wants me to make her some apps to use around the house.
I have a basic app that loads a JPG into a WebView window. I read that in order to help manage caching it's a good idea to add a timestamp to a URL.
I am not sure how to add a Timestamp into the URL.
This is what I have now:
mWebView.loadUrl("http://www.website.com/webviewimage.jpg"+"?123");
I plan to replace the "?123" with the Timestamp, but I'm not sure how to type this in. I have this in the beginning of my code so hopefully, I'm thinking I'm halfway there.:
import java.sql.Timestamp;
Thank you so much for your help.
Cheers,
Pat
This will put the current time in milliseconds on to the end of your URL.
mWebView.loadUrl("http://www.website.com/webviewimage.jpg?" + System.currentTimeMillis());
Related
I'm developing an Android app that might use Wikipedia API to retrieve the content of a given page (from its title). I searched a lot in the web but I don't find useful information about the implementation. I read the MediaWiki documentation and I tried to format my requests in json format (example: request for "mountain" page content but the text isn't clear and I don't know how manage the request from my Android application.
So, my question is: how can I getting (clear) wikipedia page content by passing the title page from my application? And how to save the well format content in a String (that will corresponds with a TextView in a second moment)?
Anyone knows a good tutorial or can help me with some snippets?
Thank you very much indeed guys! :)
action=parse or action=mobileview or action=query&prop=extracts, depending on what exactly do you need. Use the API sandbox to interactively experiment with various requests, it has usage examples and shows how to build requests properly.
I a'm writing a timetable app for my school. Therefore I would have to send a notification if the timetable has been changed. So this would be a change in the html code. I can't use the if modified since option because this webpage is automatically updated, so I have to notice a change in the html code.
I hope someone can help me out of here.
There's two ways to do this well, and neither involves looking at the HTML.
1)Write a webservice to query for the raw information. This can include a timestamp of the last update which you can just compare
2)Do the entire feature via push messaging rather than pull.
The only reasons to even consider checking the HTML for this is if you're doing this without the school's help and screen scraping the information. In which case you may as well just do a string.equals between the last html you got and the current one, there's no better way in that case.
I want to get the source code from various url so that i can parse them, is there any way to do this?
I tried some solutions but they where to slow, i need to get the source from 20 website the fastest way possible.
Thank you for the time
I've used HtmlCleaner in android successfully. Also take a look at this SO question
I need to extract little piece of Data from Youtube Data API (with params), but what i have only seen , is that i must parse all data to get it ...
Let's see the example that i need :
URL = http://gdata.youtube.com/feeds/api/videos/2ILsMmZG4VM
http://gdata.youtube.com/feeds/api/videos/2ILsMmZG4VM2007-06-03T12:41:05.000Z2011-08-03T08:29:25.000ZDARKER THAN BLACK OPENING HD:EDIT:
First Darker than Black opening. I uploaded this a long time ago and was NOT aware of the poor translations so please don't be upset and just enjoy the music/animation. If the translations really bother you, then watch a different video. Seriously guys...JuN0http://gdata.youtube.com/feeds/api/users/jun0Film:EDIT:
First Darker than Black opening. I uploaded this a long time ago and was NOT aware of the poor translations so please don't be upset and just enjoy the music/animation. If the translations really bother you, then watch a different video. Seriously guys...darker, then, black
And more deep , i can see the part i need , which is the RTSP link :
...media:content url='rtsp://v7.cache8.c.youtube.com/CiILENy73wIaGQlT4UZmMuyC2BMYESARFEgGUgZ2aWRlb3MM/0/0/0/video.3gp' type='video/3gpp' medium='video' expression='full' duration='101' yt:format='6'/
Then what i need to know if exist params to put in the link to extract directly the URL , to not have to parse all the XML .
Thanks for all , and forgive my bad english.
SOLUTION:
I have found it thx to Sherif (1 point for you)
http://gdata.youtube.com/feeds/api/videos?q="2ILsMmZG4VM"&fields=entry(media:group(media:content))
Try this:
http://gdata.youtube.com/feeds/api/videos?q="2ILsMmZG4VM"&fields=entry(media:content)
However The fields parameter is currently used for experimental features only
I'm in the middle of writing an Android app, and would like to give my users the ability to share the document files it creates.
What I'd ideally like to see would be files hosted on a HTTP server somewhere, so a user can simply fire up their browser on the Android phone, surf to the relevant page, and then download the file to their phone. I'd then like for my app to be able to open that downloaded file.
I'm not sure if that's possible at all, but would certainly be interested in hearing from anyone that knows anything about such things. Unfortunately I seem to be having difficulty coming up with the answers myself - like much of the rest of the Android SDK, there is a severe shortage of relevant documentation.
When the user access a file you wish to support you should be able to register with Android using IntentFilters to indicate that your application is able to handle a specific MIME-TYPE.
See the documentation here .
It's easy enough to get files from a web server.
In your includes -
import java.net.URL;
import java.net.URLConnection;
import java.io.InputStream;
In your code -
URL requestURL = new URL(urlStringForFileYouWantToOpen);
URLConnection connection = requestURL.openConnection();
InputStream response = connection.getInputStream();
Then do what you want with the InputStream. I'm not sure if that's close enough to your description of the user downloading a file and then accessing it from your app, but it seems more straightforward to me to let them get the file while in your app.
Incidentally, I've stumbled across a reasonable solution that is a fair bit easier than messing around with intents and so on...
The WebView widget allows you to set a DownloadListener object that gets notified whenever the WebView is directed to a file of a type it doesn't natively understand. Thus, the functionality I was after can be achieved by creating a WebView in my application and registering a DownloadListener to listen for when the user downloads one of my application's document files.
Thanks for all your help!
If you want to integrate the download from within the app then #jball's answer is what you need if your would prefer that the process is initiated via the browser then #Scott's answer is what you need.
From your description it sounds like you also want users to share documents created with the app which would require your app to be able to upload apps to the webserver. Something like WebDAV would be ideal for that, either implemented yourself using org.apache.http library or using one of the open source implementations out their.