[Java for Android App Development] Aquen:
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:

RssReader.java

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();
}
}

RssParseHandler

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;
}

@Override
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)){
parsingTitle=true;
} else if ("url".equals(qName)){
parsingLink = true;
}
};

@Override
public void endElement (String uri, String localName, String qName)
throws SAXException{
if ("content-item".equals(qName)){
rssItems.add(currentItem);
currentItem = null;
} else if ("title".equals(qName)){
parsingTitle = false;
} else if ("url".equals(qName)){
parsingLink = false;
}
}

@Override
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;
}
}
}
}

ListListener

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);
i.setData(Uri.parse(listItems.get(pos).getLink()));
activity.startActivity(i);
}
}

RssItem

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;
}
}

MainActivity

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 {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

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.setAdapter(adapter);
Items.setOnItemClickListener(new ListListener(rssReader.getItems(), this)); } catch (Exception e){
Log.e("SimpleRssReader", e.getMessage());
}
}

@Override
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 :)