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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:31:22+00:00 2026-06-03T09:31:22+00:00

I have a listView in which I bound a column of a table with

  • 0

I have a listView in which I bound a column of a table with customCursorAdapter i.e CoordinatorTag like(Home,Office,Factory) etc. from Coordinator Table .but with these tags I also wish to add an extra item in list named ALL at last. how I can do this sir please help me.

thanks
Om Parkash

  • 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-03T09:31:25+00:00Added an answer on June 3, 2026 at 9:31 am

    Check out this …..

    I hope this example will helpfull for you

    Create /res/layout/row.xml

      <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <TextView
    android:id="@+id/listtitle"
    android:textSize="22px"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>
    <TextView
    android:id="@+id/listpubdate"
    android:textSize="10px"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"/>
    </LinearLayout>
    

    now create a class for using a cursor adapter in ListView

    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.util.List;
    
    import javax.xml.parsers.ParserConfigurationException;
    import javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.XMLReader;
    
    import android.app.ListActivity;
    import android.content.Context;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.ViewGroup;
    import android.widget.ArrayAdapter;
    import android.widget.ListView;
    import android.widget.TextView;
    
    public class AndroidRssReader extends ListActivity {
    
    private RSSFeed myRssFeed = null;
    
    public class MyCustomAdapter extends ArrayAdapter<RSSItem> {
    
     public MyCustomAdapter(Context context, int textViewResourceId,
       List<RSSItem> list) {
      super(context, textViewResourceId, list);
     }
    
     @Override
     public View getView(int position, View convertView, ViewGroup parent) {
      // TODO Auto-generated method stub
      //return super.getView(position, convertView, parent);
    
      View row = convertView;
    
      if(row==null){
       LayoutInflater inflater=getLayoutInflater();
       row=inflater.inflate(R.layout.row, parent, false);
      }
    
      TextView listTitle=(TextView)row.findViewById(R.id.listtitle);
      listTitle.setText(myRssFeed.getList().get(position).getTitle());
      TextView listPubdate=(TextView)row.findViewById(R.id.listpubdate);
      listPubdate.setText(myRssFeed.getList().get(position).getPubdate());
    
      if (position%2 == 0){
       listTitle.setBackgroundColor(0xff101010);
       listPubdate.setBackgroundColor(0xff101010);
      }
      else{
       listTitle.setBackgroundColor(0xff080808);
       listPubdate.setBackgroundColor(0xff080808);
      }
    
      return row;
     }
    }
    
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
    
          try {
      URL rssUrl = new URL("http://www.gov.hk/en/about/rss/govhkrss.data.xml");
      SAXParserFactory mySAXParserFactory = SAXParserFactory.newInstance();
      SAXParser mySAXParser = mySAXParserFactory.newSAXParser();
      XMLReader myXMLReader = mySAXParser.getXMLReader();
      RSSHandler myRSSHandler = new RSSHandler();
      myXMLReader.setContentHandler(myRSSHandler);
      InputSource myInputSource = new InputSource(rssUrl.openStream());
      myXMLReader.parse(myInputSource);
    
      myRssFeed = myRSSHandler.getFeed();
    
     } catch (MalformedURLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
     } catch (ParserConfigurationException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
     } catch (SAXException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
     } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
     }
    
     if (myRssFeed!=null)
     {
      TextView feedTitle = (TextView)findViewById(R.id.feedtitle);
      TextView feedDescribtion = (TextView)findViewById(R.id.feeddescribtion);
      TextView feedPubdate = (TextView)findViewById(R.id.feedpubdate);
      TextView feedLink = (TextView)findViewById(R.id.feedlink);
      feedTitle.setText(myRssFeed.getTitle());
      feedDescribtion.setText(myRssFeed.getDescription());
      feedPubdate.setText(myRssFeed.getPubdate());
      feedLink.setText(myRssFeed.getLink());
    
      MyCustomAdapter adapter =
       new MyCustomAdapter(this, R.layout.row, myRssFeed.getList());
      setListAdapter(adapter);
    
     }
      }
    
    @Override
    protected void onListItemClick(ListView l, View v, int position, long id) {
     // TODO Auto-generated method stub
     Intent intent = new Intent(this,ShowDetails.class);
     Bundle bundle = new Bundle();
     bundle.putString("keyTitle", myRssFeed.getItem(position).getTitle());
     bundle.putString("keyDescription", myRssFeed.getItem(position).getDescription());
     bundle.putString("keyLink", myRssFeed.getItem(position).getLink());
     bundle.putString("keyPubdate", myRssFeed.getItem(position).getPubdate());
     intent.putExtras(bundle);
          startActivity(intent);
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a ListView which contains objects bound from an collection. The representation of
I have a ListView which has bound data, and two additional bindings like this:
I have a list of places in listview which i got from parsing JSON.
I have a listview which displays items retrieved from the webpage. Each item in
I have a parent window which has a ListView that is bound to an
I have a ListView which layout looks like a Windows Explorer view (icon +
I have a page with few listview and a few datalist, which are bound
I have a ListView which I have bound with a List . If I
I have an Android activity in which I have a ListView bound to a
I have ListView which is saving all data to database. For adding i have

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.