Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

What method should I use to add new information to an app so every time it is open or refreshed the user sees the info

What method should I use to add new information to an app so every time it is open or refreshed the user sees the new information/post added.

For instance, I want to add a picture or post to my app. That new post I want all those who are using the app to see that information...

So every time the app is edited the user will see that new information...

2 Answers

Hi Opal

The only way really for your app to refresh data every time it opens is to source data from the web. Now if you have control over a website of your own you could implement a simple GET method within your website to return some content you setup, however this is too troublesome for most people. I'm not sure what content you want your users to see but I would recommend searching the web for RSS feeds.

RSS is a standard devised for just the thing you need. There are huge numbers of sites now with RSS feeds set up where you can request new data from at will, these download as XML files which you can manipulate within your app to download images etc via links in the RSS feed or use text.

It is too complex to show an easy implementation in this question, there are a few examples in the link below

http://www.tutorialspoint.com/android/android_rss_reader.htm

Hope this helps

Daniel

Hey,

Thank you for the response Daniel, What I'm getting at is...

Say you have an app which displays movies showing for the week, you have a list of five movies but then later on you add 3 new movies to the list. I'm just wondering how could I add that movie to the list and all users of the app will get the update as well.

Hi

You would have to do as above unfortunately. You could of course release updated versions for your app to the play store every day but that would annoy the hell out of everybody. If you want to have live data in your app the only way is to reference it in your app from a single position (in this case your computer putting it on the web). This does of course mean you would have to create some back end code or use a back end service such as Parse to handle this for you.

Parse is covered in the self destructing app project here on android if you're interested and you could adopt it to create your own custom classes which return the data your after (with a bit of cursing and shouting at the screen), it's free to use for small projects and saves the hassle and cost of running your own servers etc.

I have used, more recently, the dropbox api which was free in an app or mine to help with the transferring of files, although it was in the reverse to your situation from what i read up on you can easily manipulate it to get a file from a dropbox account which could contain JSON data or something similar to update a local SQL lite database within your app.

Hope this helps Daniel

Is there an e-mail or place I can send some code privately?

Thank You Daniel for the quick response and insight. I appreciate that.