creating a 3 day BBC Android weather app - android

I'm bit of a basic programmer so forgive me if this sounds super basic and easy. I have been tasked to create a 3 day weather app by only using the BBC RSS feed, shown in the link here (this is a manchester RSS feed, i can probably add more feeds if i can).
http://open.live.bbc.co.uk/weather/feeds/en/2643123/3dayforecast.rss
i have only seen ones with yahoo, i don't know if it is similar to the BBC RSS feed. Also many of them contain something called 'JSON' which i have no idea if it can help me or hurts me if i follow the tutorials from that.
Thanks if anyone can help me.

I'm not sure what your actual question is, but JSON is a standard format for transferring objects between programs. It is explained well in this stack overflow post. A good library to handle JSON in Java is org.json. In the future, try to come up with a specific issue to ask a question about, not a general problem.

There are different ways to accomplish this, but one basic method is:
Create an AsyncTask to access the weather data feed without blocking the main thread.
In the doInBackground() method of the AsyncTask, connect to the JSON file via an HttpUrlConnection and get the InputStream.
Create a JsonReader to access the required data from your InputStream.
In the onPostExecute() method of the AsyncTask, update your UI with the data.
If you change the extension of your URL to '.json', you will be able to access the JSON version of this file.
You could also parse the XML (.rss extension) version of the file.
Ultimately these are fundamental concepts in Android development so you will have to do some more research.

Related

Storing Data on and accessing data from a website

This is a total noob question. Sorry in advance if it is vague, but I'm looking for advice on how to start out. I have an app that I've developed that interacts with a local sqlite3 database. Everything works great, insofar as the data is local. Now, I want to move this data away from the local device and onto my website so that the app has to call out to that URL to get/set this data.
What topics should I be looking into? I need to understand how to 1) house this data on my website, and 2) modify my app to interact with it. Again, sorry if this is vague - just looking for topics to begin my search.
Thanks!
EDIT: I'm finding lots of resources out there that describe how to retrieve data FROM the site. What I am really spinning my wheels on is how to modify data stored on a site. This is back end data. No one will ever see it directly. JSON format sounds like the way to go, but I don't know where to look for ideas of how to update this data after a user initiates a change from the app. I need to update the data on the site, not just on the local database. Thanks again!
JSON JSON JSON! JSON is awesome, and is IMO the easiest way to communicate between the web and any other platform. You can look here and here for more info on the android side. Depending on what platform you are using for your website, there are many awesome libraries to help export your info to JSON. Happy Coding!
Check out the Volley library as it will simplify and speed up greatly your network communications (get it here).
You probably want to use JSON to retrieve and send data to your web-service as it is very light and compact.
An example using Volley and JSON

Can I use an sqlite database created for ios in android?

I would like to access the string-files stored in an sqlite database created for an ios application.
Any suggested methods to do this? I have searched all over the net but have not found anyone who has done this.
I know it is possible to convert a plist file to an xml file, but in the future the app I am working on will get all the resources (including strings) from a server.
I hope someone can help with this.
You could just include the SQLite database file as an asset in your app then use it like any other SQLite DB in Android.
You then mention that you will get resources from the server and I assume from your question that the data is currently in pLists so I think there may be 2 questions in one?
You might consider using JSON which, in many cases, is much faster than parsing XML. I recently used "Sublime Text" to convert a bunch of plists to JSON. It did a great job. v1 of my app parsed pLists. I tried SAX, DOM and the pull parser to find the quickest (SAX in this case) but, after conversion to JSON, v2 of the app is much, much faster. I haven't measured it because I don't need to. The user experience is enough. Where I previously had to use a loading progress dialog on a particularly large pList, with the new JSON parser, the UI is responsive at all times.

Offline accessible RSS feed with images

I'm new to android since a short period and after looking around on different forums (including this one) i couldn't really make up what the best way would be of parsing my RSS feed.
Here's my problem:
I'm creating an application that is to be used on the north and south pole. Places with basicly no connection.
I will be putting available a dictionary of all the animal life on both these poles.
The point of the application is that it has to be able to be synchronized when back on the mainland. (Because this dictionary keeps growing and changing)
The information will be put available trough an online RSS feed.
Now my question is, what is the best (and possebly easiest) way of doing this?
This is how the RSS feed will be build up
I have a few years knowledge of Java programming (Worked with netbeans), Now i'm using Eclipse. I already managed to create a local database with the columns i need to store the information in (SQLite). Now my next challenge is how to bring the content from the web to this local database (including the enclosured image if possible)
Hope someone can help me with this problem. In the meantime i'll be browsing further in search of an anwser.
Awaiting your reply
Regards
Check out the answers here: https://stackoverflow.com/questions/1253788/simple-rss-parser-for-android
If that ship hasn't sailed yet get them to publish the data as a JSON string. Takes only ~30 lines of code to grab the string and populate a Java data object with it.

Read HTML file from Website and convert into App

I am looking into developing an App that will convert a website into more readable data for an android app. I am at university and have an online notice board which can be viewed on the web but if possible I would like to transfer this into an app on android to make it more easy to read on mobile devices.
What I thinking is that the app would go to the website where the notice board is held and read in the html code to display each notice in a list adapter view. Each notice is within its own div so I assume I could use that to split each notice up into its own button on the list adapter view. Is this possible and if so how I can go about doing this. I have tried google for an answer but I have not yet found a solution to this problem.
Thanks for your help
It seems overly complicated to me. I wouldn't handle all that using Android. I'd crawl the data on a machine (server) and then I'd convert all needed data to JSON and have the Android (client) fetch the data using a simple JSON parser.
In my opinion that would be the easiest solution if you don't have access to the server the website is hosted on to get it generate a JSON feed for you directly.
EDIT: In answer to your comment Boardy.
Here is the official website of the JSON project in order to get an understanding of what it is. Then if you have access to the webserver providing that page (I assume it is a PHP based site) and want to modify or add the functionality of providing a JSON feed then you should also take a look at the PHP JSON documentation.
To parse JSON on Android check out this SO question and also don't forget to take a look at the official Android documentation on their JSON implementation.

Show feeds in android

I want to show feeds from a blog in a listview. It would be really help if you guys can suggest some tutorials or how to do it?
thanks in adv.
I can point you in the right direction, using standard Android SDK components.
Your solution will consist of several pieces - an HTTP downloader, an RSS parser (presumably the blogs have public RSS feeds), a ListAdaptor, and your ListView.
Firstly, you need to grab the RSS file from the blog. There are a bunch of ways to do this, I'd suggest using HttpClient and HttpGet.
Next, you'll need to parse the RSS file you downloaded. For this, you can use XMLReader. Writing a good RSS parser is probably the trickiest bit!
Now you've got your data parsed, store it in a list and write a ListAdaptor.
Hook the ListAdaptor upto your ListView using setAdaptor and you're good to go.
If this all sounds a bit complicated, there are various Java RSS libraries that'll perform steps 1 and 2 for you.
You may also want to take a look at the source code of android-rss, and give IBM's XML article a good read!

Categories

Resources