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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:24:11+00:00 2026-05-13T06:24:11+00:00

Is there a working example out there that demonstrates how to append additional rows

  • 0

Is there a working example out there that demonstrates how to append additional rows in ListView dynamically?
For example:

  1. you are pulling RSS feeds from
    different domains
  2. you then display the first 10 items
    in the ListView (while you have
    other threads running in the
    background continue pulling feeds)
  3. you scroll and reach the bottom of
    the List and click at a button to
    view more items
  4. the ListView will then get appended
    with additional 10 items, which
    makes 20 items now in total.

Any advice how to accomplish this?

Nicholas

  • 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-13T06:24:11+00:00Added an answer on May 13, 2026 at 6:24 am

    To add new item to your list dynamically you have to get adapter class from your ListActivity and simply add new elements. When you add items directly to adapter, notifyDataSetChanged is called automatically for you – and the view updates itself.

    You can also provide your own adapter (extending ArrayAdapter) and override the constructor taking List parameter. You can use this list just as you use adapter, but in this case you have to call adapter.notifyDataSetChanged() by yourself – to refresh the view.
    Please, take a look at the example below:

    public class CustomList extends ListActivity {
    private LayoutInflater mInflater;
    private Vector<RowData> data;
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        
        mInflater = (LayoutInflater) getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
        data = new Vector<RowData>();
        RowData rd = new RowData("item1", "description1");
        data.add(rd);
        rd = new RowData("item2", "description2");
        data.add(rd);
        rd = new RowData("item2", "description3");
        data.add(rd);
    
        CustomAdapter adapter = new CustomAdapter(this, R.layout.custom_row,R.id.item, data);
        setListAdapter(adapter);        
        getListView().setTextFilterEnabled(true);
    }
    
    
    public void onListItemClick(ListView parent, View v, int position, long id) {
        CustomAdapter adapter = (CustomAdapter) parent.getAdapter();
        RowData row = adapter.getItem(position);        
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(row.mItem); 
        builder.setMessage(row.mDescription + " -> " + position );
        builder.setPositiveButton("ok", null);
        builder.show();
    }
    
    /**
     * Data type used for custom adapter. Single item of the adapter.      
     */
    private class RowData {
        protected String mItem;
        protected String mDescription;
    
        RowData(String item, String description){
            mItem = item;
            mDescription = description;         
        }
    
        @Override
        public String toString() {
            return mItem + " " +  mDescription;
        }
    }
    
    private class CustomAdapter extends ArrayAdapter<RowData> {
    
        public CustomAdapter(Context context, int resource,
                int textViewResourceId, List<RowData> objects) {
            super(context, resource, textViewResourceId, objects);
    
        }
    
        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder = null;
    
            //widgets displayed by each item in your list
            TextView item = null;
            TextView description = null;
    
            //data from your adapter
            RowData rowData= getItem(position);
    
    
            //we want to reuse already constructed row views...
            if(null == convertView){
                convertView = mInflater.inflate(R.layout.custom_row, null);
                holder = new ViewHolder(convertView);
                convertView.setTag(holder);
            }
            // 
            holder = (ViewHolder) convertView.getTag();
            item = holder.getItem();
            item.setText(rowData.mItem);
    
            description = holder.getDescription();      
            description.setText(rowData.mDescription);
    
            return convertView;
        }
    }
    
    /**
     * Wrapper for row data.
     *
     */
    private class ViewHolder {      
        private View mRow;
        private TextView description = null;
        private TextView item = null;
    
        public ViewHolder(View row) {
            mRow = row;
        }
    
        public TextView getDescription() {
            if(null == description){
                description = (TextView) mRow.findViewById(R.id.description);
            }
            return description;
        }
    
        public TextView getItem() {
            if(null == item){
                item = (TextView) mRow.findViewById(R.id.item);
            }
            return item;
        }       
    }
    

    }

    You can extend the example above and add “more” button – which just add new items to your adapter (or vector).
    Regards!

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

Sidebar

Ask A Question

Stats

  • Questions 259k
  • Answers 259k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Have a look at the jsonReader option on the jqGrid… May 13, 2026 at 11:07 am
  • Editorial Team
    Editorial Team added an answer In the first case you are calling the CONVERT function… May 13, 2026 at 11:07 am
  • Editorial Team
    Editorial Team added an answer To answer your question: No, you can't do a cross… May 13, 2026 at 11:07 am

Related Questions

Anyone who's tried to study mathematics using online resources will have come across these
BACKGROUND: WYSIWYG HTML editors tend to be both intuitive and smart. Intuitive means someone
I have a Windows Mobile application using the compact framework (NETCF) that I would
I'm designing a database for internal use at my company that will store data
The sad truth about this post is that I have poor regex skills. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.