Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6126271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:21:07+00:00 2026-05-23T16:21:07+00:00

I’m trying to follow this tutorial http://automateddeveloper.blogspot.com/2011/05/android-rss-reader-20.html I’m using eclipse and developing for android

  • 0

I’m trying to follow this tutorial http://automateddeveloper.blogspot.com/2011/05/android-rss-reader-20.html
I’m using eclipse and developing for android 2.0

here is the problem
*I cant figure out how to set an onclick listener or something similar to each article
*I’m trying to make it go to the website the article is from onclick

public class Utezone 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>();
    try {
        jobs = RssReader.getLatestRssFeed();

    } catch (Exception e) {
        Log.e("RSS ERROR", "Error loading RSS Feed Stream >> " + e.getMessage() + " //" + e.toString());
    }





    adapter = new RssListAdapter(this,jobs);
    setListAdapter(adapter);
}

}

public class RssListAdapter extends ArrayAdapter<JSONObject> {

public RssListAdapter(Activity activity, List<JSONObject> imageAndTexts) {
    super(activity, 0, imageAndTexts);
}


@Override
public View getView(int position, View convertView, ViewGroup parent) {

    Activity activity = (Activity) getContext();
    LayoutInflater inflater = activity.getLayoutInflater();

    // Inflate the views from XML
    View rowView = inflater.inflate(R.layout.image_text_layout, null);
    JSONObject jsonImageText = getItem(position);

    //////////////////////////////////////////////////////////////////////////////////////////////////////
    //The next section we update at runtime the text - as provided by the JSON from our REST call
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    TextView textView = (TextView) rowView.findViewById(R.id.job_text);

    try {
        Spanned text = (Spanned)jsonImageText.get("text");
        textView.setText(text);

    } catch (JSONException e) {
        textView.setText("JSON Exception");
    }

    return rowView;

} 


}


public class RssReader {

private final static String BOLD_OPEN = "<B>";
private final static String BOLD_CLOSE = "</B>";
private final static String BREAK = "<BR>";
private final static String ITALIC_OPEN = "<I>";
private final static String ITALIC_CLOSE = "</I>";
private final static String SMALL_OPEN = "<SMALL>";
private final static String SMALL_CLOSE = "</SMALL>";

/**
 * This method defines a feed URL and then calles our SAX Handler to read the article list
 * from the stream
 * 
 * @return List<JSONObject> - suitable for the List View activity
 */
public static List<JSONObject> getLatestRssFeed(){
    String feed = "thefeedurl";

    RSSHandler rh = new RSSHandler();
    List<Article> articles =  rh.getLatestArticles(feed);
    Log.e("RSS ERROR", "Number of articles " + articles.size());
    return fillData(articles);
}


/**
 * This method takes a list of Article objects and converts them in to the 
 * correct JSON format so the info can be processed by our list view
 * 
 * @param articles - list<Article>
 * @return List<JSONObject> - suitable for the List View activity
 */
private static List<JSONObject> fillData(List<Article> articles) {

    List<JSONObject> items = new ArrayList<JSONObject>();
    for (Article article : articles) {
        JSONObject current = new JSONObject();
        try {
            buildJsonObject(article, current);
        } catch (JSONException e) {
            Log.e("RSS ERROR", "Error creating JSON Object from RSS feed");
        }
        items.add(current);
    }

    return items;
}


/**
 * This method takes a single Article Object and converts it in to a single JSON object
 * including some additional HTML formating so they can be displayed nicely
 * 
 * @param article
 * @param current
 * @throws JSONException
 */
private static void buildJsonObject(Article article, JSONObject current) throws JSONException {
    String title = article.getTitle();
    String description = article.getDescription();
    String date = article.getPubDate();

    StringBuffer sb = new StringBuffer();
    sb.append(BOLD_OPEN).append(title).append(BOLD_CLOSE);
    sb.append(BREAK);
    sb.append(description);
    sb.append(BREAK);
    sb.append(SMALL_OPEN).append(ITALIC_OPEN).append(date).append(ITALIC_CLOSE).append(SMALL_CLOSE);

    current.put("text", Html.fromHtml(sb.toString()));
}
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:21:07+00:00Added an answer on May 23, 2026 at 4:21 pm

    Since the activity extends ListActivity you can simply do:

    protected void onListItemClick(ListView l, View v, int position, long id) {
       super.onListItemClick(l, v, position, id);
       //do something
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I am trying to understand how to use SyndicationItem to display feed which is
I am trying to loop through a bunch of documents I have to put
Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.