Rss Item Funktioniert noch nicht richtig

  • 1 Antworten
  • Letztes Antwortdatum
S

schlossero

Neues Mitglied
0
Hallo zusammen.
Ich habe eine App erstellt die mir unter anderem eine Rss Liste anzeigt.
Beim Klick auf ein Item soll der Inhalt dargestellt werden.

Leider funktioniert dies noch nicht richtig. der Inhalt wird nicht dargestellt sondern

div class="feed-description"

Ich hoffe Ihr könnt mir Helfen.
Hier der Code für den Inhalt.
Code:
package com.fffeldhausen.android.reader;

import com.fffeldhausen.android.reader.R;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class ShowDetails extends Activity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.content);
		TextView detailsTitle = (TextView)findViewById(R.id.detailstitle);
		TextView detailsDescription = (TextView)findViewById(R.id.detailsdescription);
		TextView detailsPubdate = (TextView)findViewById(R.id.detailspubdate);
		TextView detailsLink = (TextView)findViewById(R.id.detailslink);

		Bundle bundle = this.getIntent().getExtras();
		detailsTitle.setText(bundle.getString("keyTitle"));
		detailsDescription.setText(bundle.getString("keyDescription"));
		detailsPubdate.setText(bundle.getString("keyPubdate"));
		detailsLink.setText(bundle.getString("keyLink"));
		
	}
}


Und hier die erste Activity

Code:
package com.fffeldhausen.android.reader;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import com.fffeldhausen.android.reader.R;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class AndroidRssReader extends ListActivity {
	
	private RSSFeed myRssFeed = null;
	
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.nachrichten);
		
		try {
			URL rssUrl = new URL("http://www.feuerwehr-feldhausen.de/index.php/ueber-uns/presse/2009/rss?format=feed&type=rss");
			SAXParserFactory mySAXParserFactory = SAXParserFactory.newInstance();
			SAXParser mySAXParser = mySAXParserFactory.newSAXParser();
			XMLReader myXMLReader = mySAXParser.getXMLReader();
			RSSHandler myRSSHandler = new RSSHandler();
			myXMLReader.setContentHandler(myRSSHandler);
			InputSource myInputSource = new InputSource(rssUrl.openStream());
			myXMLReader.parse(myInputSource);
			
			myRssFeed = myRSSHandler.getFeed();	
		} catch (MalformedURLException e) {
			e.printStackTrace();	
		} catch (ParserConfigurationException e) {
			e.printStackTrace();	
		} catch (SAXException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();	
		}
		
		if (myRssFeed!=null)
		{
			TextView feedTitle = (TextView)findViewById(R.id.feedtitle);
			TextView feedDescribtion = (TextView)findViewById(R.id.feeddescribtion);
			TextView feedPubdate = (TextView)findViewById(R.id.feedpubdate);
			TextView feedLink = (TextView)findViewById(R.id.feedlink);
			feedTitle.setText(myRssFeed.getTitle());
			feedDescribtion.setText(myRssFeed.getDescription());
			feedPubdate.setText(myRssFeed.getPubdate());
			feedLink.setText(myRssFeed.getLink());
			
			ArrayAdapter<RSSItem> adapter =
					new ArrayAdapter<RSSItem>(this,
							android.R.layout.simple_list_item_1,myRssFeed.getList());
			setListAdapter(adapter);	
		}	
	}
	
	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Intent intent = new Intent(this,ShowDetails.class);
		Bundle bundle = new Bundle();
		bundle.putString("keyTitle", myRssFeed.getItem(position).getTitle());
		bundle.putString("keyDescription", myRssFeed.getItem(position).getDescription());
		bundle.putString("keyLink", myRssFeed.getItem(position).getLink());
		bundle.putString("keyPubdate", myRssFeed.getItem(position).getPubdate());
		intent.putExtras(bundle);
		startActivity(intent);	
	}
}
 
Fehler gefunden.

Danke
 

Ähnliche Themen

AnnaBauer21
Antworten
0
Aufrufe
503
AnnaBauer21
AnnaBauer21
AnnaBauer21
Antworten
6
Aufrufe
1.027
AnnaBauer21
AnnaBauer21
Zurück
Oben Unten