mayanoob.blogg.se

Rss reader app android
Rss reader app android













rss reader app android
  1. RSS READER APP ANDROID UPDATE
  2. RSS READER APP ANDROID ANDROID
  3. RSS READER APP ANDROID CODE
  4. RSS READER APP ANDROID DOWNLOAD

So what we can do to parse this XML file is to setup 3 boolean variables starting at line 23. Then endElement() would be called passing in "ele" for the second argument. Then characters() would be called passing in an array of characters "chars". First startElement() would be called passing in "ele" for the second argument. To illustrate this using a simple xml tag: charsĪll 3 funtions would be called to parse this string. characters - This is called when we are between the start and end.endElement - This function is called when the parser reaches the end of an element.startElement - This function is called when the parser reaches an element.Now we have 3 functions working to parse this document, it starts at the beginning of the document and calls each of these 3 functions as it moves through the document: We set this class as our ContentHandler and we pass in the xml stream to the XMLReader using the supplied url.

rss reader app android

We create a SAXParserFactory so we can create a SAXParser so we can create a XMLReader! Anyways, lines 120 and 121 are where we kick this off. For the articles we need the title and the url from the XML. For the feed object we just need to find its title.

RSS READER APP ANDROID UPDATE

We will update the currentFeed object or currentArticle object as we find out more from the XML file. After that we set what we know in our currentFeed object (the url the user input). Next we initialize our droidDB object so that once we get everything we need from the XML we can stick it in the database. openStream ( ) ) ) įirst we set the targetFlag so that the rest of the functions know what our target is from the XML file, we are looking specifically for a feed.

rss reader app android

Here is the NewsDroidDB class declaration and the constructor:

  • Get Data - We need to be able to pull the data to display in our ListActivities.
  • Delete Data - If we can insert we need to be able to delete right?.
  • Insert Data - Will need to be able to insert a feed or an article.
  • Create Tables - We will need to be able to create tables for the feeds and articles if they don't exist, this will be handled in the constructor.
  • Here are the list of things this class will need to accomplish: Now that we know the layout of our tables we can start working on our NewsDroidDB class. We also need the title of the article and the url to the article:Ĭreate table articles (articl e_id integer primary key autoincrement, feed_id int not null, title text not null, url text not null ) So to create our table "feeds" we will run a create statement as follows:Ĭreate table feeds (feed_i d integer primary key autoincrement, title text not null, url text not null ) Īnd for the articles we need to store the feed_id so that we know what feed the article is for. In addition we will want a unique id for each feed so that we can have an articles table that relates to the feeds table. Before we create the NewsDroidDB we need to design the layout of the database:įor each RSS Feed we need the the title of the feed and the URL for the xml file so that we can fetch the articles. This class will be responsible for creating the database and inserting or deleting records. Our first task will be to create the NewsDroidDB class. On page 4 we put it all together with a couple ListActivities and a URL Entry Box On page 3 we discuss the RSS Parsing using a SAX object. On page 2 we discuss the database backend components.

    RSS READER APP ANDROID DOWNLOAD

    You may want to download the complete source for reference as you view this tutorial.

  • URLEditor - Activity that allows the user to enter the URL for the feed.
  • FeedsList - ListActivity that displays the Feeds.
  • ArticlesList - ListActivity that displays the Articles.
  • RSSHandler - Parses RSS feed and saves what we need from them.
  • NewsDroidDB - Handles all the SQL Lite database work.
  • Feed - Simple class to hold the values of a feed, ie the title of the feed and url to the XML file.
  • rss reader app android

    Article - Simple class to hold the values of an article, ie the the title and url.When a user then selects a headline they will be taken directly to that story in the web browser. The application will open with a list of all of the RSS feeds that you have added, and when a user clicks on a feed then it will display a list of the headlines for that feed. In this tutorial we will build a simple RSS reader called "NewsDroid" so that you can get all the headlines without having to hit all your favorite sites in that little browser.

    RSS READER APP ANDROID CODE

    Also, the line numbers next to the code correspond to the line numbers in the java files. So when you see a class like "Activity" in the code you can click on it and be taken to the documentation for that class.

    RSS READER APP ANDROID ANDROID

    The syntax highlighting in these tutorials will create hyperlinks to the documentation out of general Java and Android specific classes. If you have not run through that I would highly recommend it! Welcome to our first tutorial! This tutorial assumes that you are familiar with the official tutorial supplied by Google.















    Rss reader app android