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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:59:51+00:00 2026-06-17T08:59:51+00:00

I am new to Android and I am trying to make an app to

  • 0

I am new to Android and I am trying to make an app to get the RSS feeds from a website that will display “title” and “description”. But here, I am getting only the title not the description. In the XML part I have a listview where I get the title but not the description.

public class abcreaderextends ListActivity  {
    List<String> headlines;
    List<String> links;
    List<String> description;

public InputStream getInputStream(URL url) {
   try {
       return url.openConnection().getInputStream();
   } catch (IOException e) {
       return null;
     }
}


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_awsreader);

        // Initializing instance variables
        headlines = new ArrayList<String>();
        links = new ArrayList<String>();
        description= new ArrayList<String>();


        try {
            URL url = new URL("http://xxx.xxx.xxx/abc");

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

                // We will get the XML from an input stream
            xpp.setInput(getInputStream(url), "UTF_8");

               int i=0;
              boolean insideItem = false;

                // Returns the type of current event: START_TAG, END_TAG, etc..
            int eventType = xpp.getEventType();
            while (eventType != XmlPullParser.END_DOCUMENT) {

                i++;



                //Log.i("Tag : ",xpp.getName().toString());
                //Log.i("Text : ",xpp.nextText().toString());

                if (eventType == XmlPullParser.START_TAG)
                {

                    Log.i("Tag : ",xpp.getName().toString());

                    //Log.i("Text : ",xpp.nextText().toString());

                    if (xpp.getName().equalsIgnoreCase("item")) {
                        insideItem = true;
                    } 

                    else if (xpp.getName().equalsIgnoreCase("title")) {
                        if (insideItem)
                        {   
                            String var=xpp.nextText().toString();

                        headlines.add(var); //extract the description of article
                        Log.i("Title : ",var);      
                        //Log.i("Count : ",i+"");
                        }
                    } 

                    else if (xpp.getName().equalsIgnoreCase("description")) {
                        if (insideItem)
                        {   
                            String desc=xpp.nextText().toString();

                        description.add(desc); //extract the description of article
                        Log.i("Desc : ",desc);      
                        //Log.i("Count : ",i+"");
                        }
                    } 




                    else if (xpp.getName().equalsIgnoreCase("link")) {
                        if (insideItem)
                            links.add(xpp.nextText()); //extract the link of article
                    }
                }else if(eventType==XmlPullParser.END_TAG && xpp.getName().equalsIgnoreCase("item")){
                    insideItem=false;

                }




                eventType = xpp.next(); //move to next element
            }

        } catch (MalformedURLException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }

        // Binding data
    ArrayAdapter adapter = new ArrayAdapter(this,
                android.R.layout.simple_list_item_1, description);

        setListAdapter(adapter);


        ArrayAdapter adaptr = new ArrayAdapter(this,
                android.R.layout.simple_list_item_1, headlines);

        setListAdapter(adaptr);


    }
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
       Uri uri = Uri.parse((String) links.get(position));
       Intent intent = new Intent(Intent.ACTION_VIEW, uri);
       startActivity(intent);
    }


}
  • 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-17T08:59:52+00:00Added an answer on June 17, 2026 at 8:59 am

    first create one class

        class myData
        {
        String title;
        String desc;
    
        }
    

    declare setter and getter methods of title and description
    Now in your parsing you can create

    ArrayList<myData> arrData=new ArrayList<MyData>();
    
    
    And save your parsing data 
    with arraData.add(new MyData(title,desc));
    so finally you got arrayList of Your Data 
    

    now create custom Adapter of listView

    public class MyDataAdapter extends ArrayAdapter<myData> {
        private int resource;
        private List<myData> items;
        private Context c1;
    
        //In resource parameter you have to pass you cutom row xml layout likr row.xml
    
    
        public MyDataAdapter(Context context, int resorce,
                List<myData> items) {
            super(context, resorce, items);
            this.c1 = context;
            this.resource = resorce;
            this.items = items;
    
        }
    
        public class ViewHolder {
            private TextView title;
            private TextView description;
    
        }
    
        @Override
        public View getView(final int position, View convertView, ViewGroup parent) {
            ViewHolder holder;
                if (convertView == null) {
                LayoutInflater layoutInflater = LayoutInflater.from(getContext());
                convertView = layoutInflater.inflate(resource, parent, false);
                holder = new ViewHolder();
                holder.title = (TextView) convertView
                        .findViewById(R.id.title);
                holder.description = (TextView) convertView.findViewById(R.id.desc);
    
            holder.title.setText(items.get(position)
                    .getTitle());
            holder.description.setText(items.get(position)
                    .getDesc());
    
    
            return convertView;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new in android and i'm trying to make an android app to display
I'm pretty new to Java and Android. I'm trying to make an app that
I am trying to make an android app that retrieves info from google app
Im trying to make a request from last.fm where I will get similar artists
I am trying to make an app that opens android market page of selected
I'm new at android developing. I'm trying to make a simple drumset app, when
I am trying to make application for reading rss feeds. I made app,but it
I'm using two libraries in an android app I'm trying to make. New to
I am new to android programming and i was trying to make an app
Im trying to make a Manga Rss-Reader app using the XmlPullParser that was used

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.