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!
Related
is that possible in Android to go though whatever link and get main content from that page(f.e.text) or whatever i want to get? If yes, how i can realize that?
There is couple ways to get data from websites.
First and maybe the most popular way is parsing RSS feed from webiste. Java and Android are providing couple parsers and ways to parse xml or in this case RSS Feed. You can take a look in this examples:
https://developer.android.com/samples/BasicSyncAdapter/src/com.example.android.basicsyncadapter/net/FeedParser.html
https://www.tutorialspoint.com/android/android_rss_reader.htm
Second way is getting needed informations from API if it is provided from webiste and offten that API will be in JSON format. For example https://openweathermap.org/ will return JSON file filled with informations of weather which you can pares into your app. Also Android and Java are providing couple ways to get informations from JSON format. You can take a look on this one:
http://www.androidhive.info/2012/01/android-json-parsing-tutorial/
Third you can use support library called Jsoup for parsing HTML from particular webiste/s. You can find examples how to parse HTML on their offical webiste: https://jsoup.org/
Maybe there is more ways certanly you should look up for them.
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.
I want to create an android App that getting Arabic news by RSS Feeds.
I want to know if there are any way to dynamically get the Rss feeds and separate them according to its topics?
Thanks for Advance.
There are at least two ways of doing this.
The first way is to look for a source that provide you with different topics, here's an example of what I mean. With those different topics being treated as each individual news feed, you are able to display them separately.
The second way is to not directly display the feed using ListView. You should first, store the news feeds into somewhere for pre-processing, for instance, you can use SQLite. While storing each news, you include a new column for your desired 'grouping' for separation. After that, you can create an adapter that pull news from this source (or SQLite) and display them in your ListView.
Pardon me for only providing you with the concepts, as I don't have a sample code to show you. I hope you understand what I am trying to describe to you.
Well I am learning Android RSS Feeds parsing, and I have a question. Consider I am using Goal.com RSS feed and displaying on my Android phone.
Goal.com RSS Feed : http://www.goal.com/en-us/feeds/news?fmt=rss
But as you can see from the Rss feeds, they are only the headlines of the article containing 2 - 3 lines of the description. I was wondering is there any way I can get the complete article from it after parsing the feeds. Any pointers to guide me would be helpful . Thanks
Unfortunately, if the RSS feed doesn't contain the full article, there isn't an easy way to get it. You can look at the link tag for each item to find it on the web and then do some screen scraping, but that gets ugly fast.
#Clifton is correct. Even by this nature we can save our posts from autoposter plugins. Besides you can find the common pattern of your target web page where contents resides. You can etract that area of content programmatically.
I have read the example for Rss Parsing from the ibm site.(http://www.ibm.com/developerworks/opensource/library/x-android/).
In this example,the rss are shown in a listview and then,if you press one announcement you can see it in the web browser of the device.How could i see them in the app,with no use of the device browser?
Thanks a lot
Create a layout with a WebView then load the URL from each "announcement" using WebView.loadUrl.
I'm a little confused but you seem to have answered your own question.
You say you don't want to use the web browser on the device but the example in your question doesn't use the browser. It does exactly what you're asking for.
The idea is that you download the html from the website and then use the parser to break it up into separate "announcements" and store them in list view items in your program.
I have done a bit of this type of thing myself in android. I used jsoup java library, which makes breaking the html into the bits you want to display really easy.
If you want some more help I can give you an example of an app I made that pulls movie times from google.com/movies as an example. here are links to the classes where I did the html download and parse:
ScreenScraper.java
HtmlParser.java