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

  • SEARCH
  • Home
  • 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 6748019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:30:55+00:00 2026-05-26T12:30:55+00:00

I am working on an RSS reader and I can’t seem to figure out

  • 0

I am working on an RSS reader and I can’t seem to figure out why me text is not lining up properly.

I have looked at posts similar in nature such as:

  • android – TwoLineListItem text alignment
  • http://blog.thisisfeifan.com/2011/10/2-lines-text-in-single-choice-listview.html
  • http://developerlife.com/tutorials/?p=327

I just can’t understand why mine won’t work right.

Can anyone explain why my text is not lining up properly inside of my listview?

This is the class that the view is based on:

public class RSSReader extends Activity implements OnItemClickListener
{

public final String RSSFEEDOFCHOICE = "http://app.calvaryccm.com/mobile/android/v1/devos";

public final String tag = "RSSReader";
private RSSFeed feed = null;
private static final DateFormat PARSING_PATTERN = 
        new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z", Locale.US); 
    private static final DateFormat FORMATTING_PATTERN = 
        new SimpleDateFormat("EEEE, MMMM dd, yyyy"); 

/** Called when the activity is first created. */

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);

    // go get our feed!
    feed = getFeed(RSSFEEDOFCHOICE);

    // display UI
    UpdateDisplay();

}


private RSSFeed getFeed(String urlToRssFeed)
{
    try
    {
        // Setup the URL
       URL url = new URL(urlToRssFeed);

       // Create the factory
       SAXParserFactory factory = SAXParserFactory.newInstance();
       // create a parser
       SAXParser parser = factory.newSAXParser();

       // Create the reader (scanner)
       XMLReader xmlreader = parser.getXMLReader();
       // Instantiate our handler
       RSSHandler theRssHandler = new RSSHandler();
       // Assign our handler
       xmlreader.setContentHandler(theRssHandler);
       // Get our data via the url class
       InputSource is = new InputSource(url.openStream());
       // Perform the synchronous parse           
       xmlreader.parse(is);
       // Get the results - should be a fully populated RSSFeed instance, or null on error
       return theRssHandler.getFeed();
    }
    catch (Exception ee)
    {
        // If we have a problem, simply return null
        System.out.println(ee.getMessage());
        System.out.println(ee.getStackTrace());
        System.out.println(ee.getCause());
        return null;
    }
}
public boolean onCreateOptionsMenu(Menu menu) 
{
    super.onCreateOptionsMenu(menu);
    menu.add(Menu.NONE, 0, 0, "Refresh");
    Log.i(tag,"onCreateOptionsMenu");
    return true;
}

public boolean onOptionsItemSelected(MenuItem item){
    switch (item.getItemId()) {
    case 0:

        Log.i(tag,"Set RSS Feed");
        return true;
    case 1:
        Log.i(tag,"Refreshing RSS Feed");
        return true;
    }
    return false;
}


private void UpdateDisplay()
{
    ListView itemlist = (ListView) findViewById(R.id.itemlist);     

    //ArrayAdapter<RSSItem> adapter = new ArrayAdapter<RSSItem>(this,android.R.layout.simple_list_item_1,feed.getAllItems());

    List<Map<String, String>> data = new ArrayList<Map<String, String>>();
    for (RSSItem item : feed.getAllItems()) {
        Map<String, String> datum = new HashMap<String, String>(2);
        datum.put("title", item.getTitle());

        String outputDate;
        try {
           Date date = PARSING_PATTERN.parse(item.getPubDate());
           outputDate = FORMATTING_PATTERN.format(date);
        } catch (ParseException e) {
           outputDate = "Invalid date"; // Date parse error
        } 
        datum.put("date", outputDate);
        data.add(datum);
    }
    SimpleAdapter adapter = new SimpleAdapter(this, data,
                                              android.R.layout.simple_list_item_2,
                                              new String[] {"title", "date"},
                                              new int[] {android.R.id.text1,
                                                         android.R.id.text2});

    itemlist.setAdapter(adapter);

    itemlist.setOnItemClickListener(this);

    itemlist.setSelection(0);

}

 @Override
 public void onItemClick(AdapterView parent, View v, int position, long id)
 {

     //Log.i(tag,"item clicked! [" + feed.getItem(position).getTitle() + "]");      

     Intent itemintent = new Intent(this,ShowDescription.class);

     Bundle b = new Bundle();
     b.putString("title", feed.getItem(position).getTitle());
     b.putString("description", feed.getItem(position).getDescription());
     b.putString("link", feed.getItem(position).getLink());
     b.putString("pubdate", feed.getItem(position).getPubDate());
     b.putString("enclosure", feed.getItem(position).getEnclosure());

     itemintent.putExtra("android.intent.extra.INTENT", b);

     startActivity(itemintent);

 }

}

This is my XML for the previous class:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/itemlist" android:layout_gravity="left"
/>    
</LinearLayout>

This a visual of what is happening:

enter image description here

  • 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-26T12:30:56+00:00Added an answer on May 26, 2026 at 12:30 pm

    Looks good. Could it be that the fields are coming in with spaces? Try pulling the title off with a trim, or running the debugger to see if it’s not your code but rather the data.

    item.getTitle().trim();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently i am working on simplepie rss reader in which i have to fetch
I have been working on a easy RSS reader for my own. I am
I have a 99% working RSS reader in PHP built into my joomla frontpage,
I'm working on silverlight rss reader as schoolproject and I have one problem. I
I'm working on an RSS reader app for Android. I have it to where
I am working on an RSS reader using SimplePie. I want to pull in
Im trying to create a RSS feed reader for a project that I working
I am working a rss reader app for iphone . What are my options
I'm working on a RSS feed where full text search has to be offered
I am working on a app that reads RSS feeds and picks out the

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.