I'm still working on my (simple) RSS Reader app.
I have it working as far as that it displays the listview with the items, which displays an image if there is one and the article title.
Now I managed to make the items go to an URL page, however whatever item i click it allways gets the URL of the last item in the list.
here is the RssReaderActivity:
Using java Syntax Highlighting
- package com.tmm.android.rssreader;
- import java.net.URL;
- import java.util.ArrayList;
- import java.util.List;
- import org.json.JSONObject;
- import android.app.ListActivity;
- import android.content.Intent;
- import android.net.Uri;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.ListView;
- import com.tmm.android.rssreader.reader.RssReader;
- import com.tmm.android.rssreader.util.Article;
- public class RssActivity extends ListActivity {
- private RssListAdapter adapter;
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- List<JSONObject> jobs = new ArrayList<JSONObject>();
- jobs = RssReader.getLatestRssFeed();
- adapter = new RssListAdapter(this, jobs);
- setListAdapter(adapter);
- }
- @Override
- protected void onListItemClick(ListView l, View v, int position, long id) {
- // TODO Auto-generated method stub
- super.onListItemClick(l, v, position, id);
- URL webURL = Article.url;
- Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(webURL
- .toString()));
- startActivity(myIntent);
- }
- }
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
this is a part of the article class:
Using java Syntax Highlighting
- public URL getUrl() {
- return url;
- }
- /**
- * @param url
- * the url to set
- */
- public void setUrl(URL url) {
- Article.url = url;
- // articleURL[RSSHandler.articlesAdded] = url;
- Log.d("Logging URL", "URL= " + url);
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
I have given a shot at making an array, but I lack the knowledge of how to use those, still I fear I have no other choice then to use an array of some sort to get this working.
Any help would be great!



