Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

Problems with RSS Reader

OP Aquen

15th February 2014, 10:42 PM   |  #1  
OP Junior Member
Thanks Meter: 0
1 posts
Join Date:Joined: Feb 2014
Hi Guys,

a friend of mine told me to ask the question here, I hope this is the right category.

I startet an android application project with an integrated RSS Reader.

I programmed it with a tutorial from a website ( I can't post the link because I'm new, sorry).
It went all good, no Errors or something like that. When I installed the .apk file on my device (Samsung S3, with standard ROM) and started it
the Rss news won't be shown. :-/

These are the files for my Rss Reader:

package com.android.simplerssreader.util;
import java.util.List;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import com.android.simplerssreader.data.RssItem;

public class RssReader {
private String rssUrl;
public RssReader(String rssUrl){
	 this.rssUrl = rssUrl;
 public List<RssItem> getItems() throws Exception {
	 SAXParserFactory factory = SAXParserFactory.newInstance();
	 SAXParser saxParser = factory.newSAXParser();
 RssParseHandler handler = new RssParseHandler();
	 saxParser.parse (rssUrl, handler);
	 return handler.getItems();
package com.android.simplerssreader.util;
import java.util.ArrayList;
import java.util.List;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import com.android.simplerssreader.data.RssItem;

public class RssParseHandler extends DefaultHandler {
	private List<RssItem> rssItems;
	private RssItem currentItem;
	private boolean parsingTitle;
	private boolean parsingLink;
	public RssParseHandler(){
	 rssItems = new ArrayList<RssItem>();
	public List<RssItem> getItems(){
	 return rssItems;
	public void startElement(String uri, String localName, String qName, 
	 Attributes attributes) throws SAXException{
	 if ("content-item".equals(qName)){
	 currentItem = new RssItem();
	 } else if ("title".equals(qName)){
	 } else if ("url".equals(qName)){
	 parsingLink = true;
	public void endElement (String uri, String localName, String qName)
	throws SAXException{
	 if ("content-item".equals(qName)){
	 currentItem = null;
	 } else if ("title".equals(qName)){
	 parsingTitle = false;
	 } else if ("url".equals(qName)){
	 parsingLink = false;
	public void characters(char[] ch, int start, int length)
	throws SAXException {
	 if (parsingTitle) {
	 if (currentItem !=null)
	 currentItem.setTitle(new String(ch,start, length));
	 } else if (parsingLink) {
	 if(currentItem !=null){
	 currentItem.setLink(new String(ch, start, length));
	 parsingLink = false;

package com.example.brueckenkopf_onlineapp;

import java.util.List;
import com.android.simplerssreader.data.*;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;

public class ListListener implements OnItemClickListener {

	List<RssItem> listItems;
	Activity activity;
	public ListListener(List<RssItem> listItems, Activity activity) {
	 this.listItems = listItems;
	 this.activity = activity;
	public void onItemClick(AdapterView<?> parent, View view, int pos, long id) {
	 Intent i = new Intent (Intent.ACTION_VIEW);

package com.android.simplerssreader.data;
public class RssItem {
 private String title;
 private String link;
public String getTitle() {
 return title;
public void setTitle(String title) {
 this.title = title;
public String getLink() {
 return link;
public void setLink(String link) {
 this.link = link;

package com.example.brueckenkopf_onlineapp;

import com.android.simplerssreader.data.RssItem;
import com.android.simplerssreader.util.RssReader;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.util.Log;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.support.v4.app.NavUtils;

public class MainActivity extends Activity {

 public void onCreate(Bundle savedInstanceState) {
 try {
 RssReader rssReader =new RssReader("Here comes the RSS Link, which I also can't post here");
 ListView Items = (ListView)findViewById(R.id.listView1);
 ArrayAdapter<RssItem> adapter = new ArrayAdapter<RssItem>(this,android.R.layout.simple_list_item_1,rssReader.getItems());
 Items.setOnItemClickListener(new ListListener(rssReader.getItems(), this)); } catch (Exception e){
 Log.e("SimpleRssReader", e.getMessage());
 public boolean onCreateOptionsMenu(Menu menu) {
 // Inflate the menu; this adds items to the action bar if it is present.
 getMenuInflater().inflate(R.menu.main, menu);
 return true;
The LogCat says it cannot open the RSS Link. But the Link is not wrong (I also tried it with an RSS Link of another website). Both don't work.

I hope you can help me
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes