I would like to write an application that notifies me whenever a class has opened up. A a naiive way would be to download the HTML source code and look for a particular string that indicates "open" (For open classes) or "waitlist" (waitlist is open) then notify me. How should I approach this? I've looked into HTPClient but it makes it more difficult than it needs to be.
Using a simple HTML parser worked for me.
Related
My application have to request some RSS feeds and display the result, i want to be able to add some feeds to the RSS list without modifying the app source code.
The app users will not have the permission to modify the RSS feeds list so i can't implement it in the app.
My idea is to create an xml configuration file and host it online, so the app can access this file on start : this solution let me update the file without updating the application.
But i don't know which online service let me to do that, do you knowa some services that are dedicated for this purpose ? Any proposal will be helpful.
Thanks.
Your not being that clear on what you want. As there are many different hosting sites. It seems your looking at just something to host your app underneath the app?? Or were you looking at something else?
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.
This may seam like a simple question, but it has been stumping me for quite a while.
Is there anyway to modify variables in an HTML code, or the HTML code itself, through an android application connected to the internet?
For example if I have a website http://count.com can I make a android application with one button which, when clicked, increments the count on the website (http://count.com).
The HTML code on the website could be a variable which is then incremented, or simple a number which is found an incremented.
I understand how to read HTML code from a website on an android application, but not how to (or if its possible to) write it.
If it is not possible if you could suggest an alternative I would be very grateful.
you can modify the HelloWord.html in your Android or in Desktop ( Android connects to Desktop via teamviewer). Save and FTP to the web hosting and is done.
The problem it is: if you didn't know this, you will not know how to do it even if I told.
I need to load several thumbnails (the images on the server are full sized images, so I need to resize them in the app), and display them in a way that allows for the user to click on one (or more) and have some associated id be given back to the app for use in a larger context.
so, in pseudo code...
ImageObjArray ioa = loadImagesFromServer("http://server/listOfImages.php");// this returns
for(ImageObj io : ioa){
drawThumbnail(io); //io contains both a jpg and a reference id
}
//later when a user clicks on a thumbnail
clickHandler(){
passIdToBundle(this.refId);
}
So, I've never played with a webview before but I suspect it might be the best approach here, though I don't know how easy it is to send info back out of a webview to the larger app when the user clicks on a thumbnail. Or is there a more elegant approach?
All advice welcome.
Using a WebView would be the quickest way to implement this. Otherwise, you have to fetch each image and write them to the device in order to display them in a native Android widget. There are several ways to approach this, like: http://www.dreamincode.net/code/snippet4724.htm
You can use WebView.addJavascriptInterface to communicate with native code. A good example can be found in the WebViewDemo from the apps-for-android project on Google Code.
You might want to consider a framework like PhoneGap to help with the Java to JavaScript interface.
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.