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 8517225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:38:22+00:00 2026-06-11T05:38:22+00:00

I am trying to display the parsed xml data in custom listview but the

  • 0

I am trying to display the parsed xml data in custom listview but the screen appears to be empty. I am trying to add the xml data in a class object and display it in custom listview.
But my class variables are not get assiging the values

List myNews = new ArrayList();

    try{
        URL url = new URL("http://timesofindia.feedsportal.com/c/33039/f/533916/index.rss");

        XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
        factory.setNamespaceAware(false);
        XmlPullParser xpp = factory.newPullParser();

         xpp.setInput(getInputStream(url), "UTF_8"); 

         boolean insideItem = false;

         int eventType = xpp.getEventType();

         while(eventType != XmlPullParser.END_DOCUMENT){

             if(eventType == XmlPullParser.START_TAG){

                 if(xpp.getName().equalsIgnoreCase("item")){
                     insideItem = true;
                 }
                 else if(xpp.getName().equalsIgnoreCase("title")){
                     if(insideItem){
                         headLines = xpp.nextText().toString();
                     }
                 }
                 else if(xpp.getName().equalsIgnoreCase("link")){
                     if(insideItem){
                         links.add(xpp.nextText());

                     }
                 }
                 else if(xpp.getName().equalsIgnoreCase("pubDate")){
                     if(insideItem){
                         date = xpp.nextText().toString();

                     }
                 }


             }
             else if(eventType == XmlPullParser.END_TAG && xpp.getName().equalsIgnoreCase("item")){
                 insideItem = false;
             }

             myNews.add(new News(headLines, date));
             eventType = xpp.next();
         }
    }
    catch (Exception e) {
        Log.d("Exception" , e.toString());
    }

    LazyAdapter adapter = new LazyAdapter(this, myNews);
   setListAdapter(adapter);
    ListView listView = getListView();
    listView.setTextFilterEnabled(true);

Here is my LazyAdapter Code…

public class LazyAdapter extends BaseAdapter {

 Activity activity;
 private List<News> myNews;


public LazyAdapter(Activity a, List<News> myNews) {
    this.activity = a;
    this.myNews = myNews;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    News news = myNews.get(position);
    View v = convertView;

    if(v == null){
        LayoutInflater inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = inflater.inflate(R.layout.list, null);
    }

    TextView heading = (TextView)v.findViewById(R.id.textView1);
    heading.setText(news.getTitle());
    TextView pubDate = (TextView)v.findViewById(R.id.textView2);
    pubDate.setText(news.getPubDate());
    heading.setText(news.getTitle());
    pubDate.setText(news.getPubDate());

    return v;
}

@Override
public int getCount() {

    return myNews.size();
}

@Override
public Object getItem(int position) {

    return myNews.get(position);
}

@Override
public long getItemId(int position) {

    return position;
}

}

  • 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-06-11T05:38:23+00:00Added an answer on June 11, 2026 at 5:38 am

    First off, I would suggest using the Spring Framework for Android to take care of your http request and parsing your XML. The framework takes care of both XML and JSON parsing in a really clean way.

    Additionally, could you post your LazyAdapter code?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

trying to display data only after variables have been set. $(document).ready(function () { function
I am trying to display some xml data from remote URL using jquery and
I am trying to parse some XML data to display in a basic web
I am trying to display data that I am getting from server through json.
I'm developing an iPhone application which uses a TableView to display XML data. The
i'm having some troubles trying to parse an XML file and display the results
I am trying to parse a XML document using Xerces, but I cant seem
I am trying to return some data retrieved from an xml file and then
I parsed my xml file successfully, but now I am getting null value. so
I am trying to pull data from api cart but I am not experienced

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.