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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:24:30+00:00 2026-05-23T09:24:30+00:00

I have to apply pagination concept on ListView my list view contains data parsed

  • 0

I have to apply pagination concept on ListView my list view contains data parsed from web service. below is code given that how I have displayed data in list view as below.

try {
    ArrayList<HashMap<String, String>> arl (ArrayList<HashMap<String, String>>)  getIntent().getSerializableExtra("arraylist");

      System.out.println("...serialized data.."+arl);
lv1 = (ListView) findViewById(R.id.lstlodgingresult);
    adapter = new SimpleAdapter(this, arl, R.layout.custom_row_view,
                    new String[] { "Srno", "Names", "URL", "Address1",  "Address2", "Telephone", "Category", "PetH",
"PetInfo" }, new int[] { R.id.txtSrno,R.id.txtname, R.id.txturl, R.id.txtaddress1,  R.id.txtaddress2, R.id.txtphone, R.id.txtcategory,
R.id.txtpetpolicyH, R.id.txtpetpolicyC }
);
lv1.setScrollbarFadingEnabled(false);
lv1.refreshDrawableState();
lv1.setAdapter(adapter);
} catch (Exception e) {
e.printStackTrace();
}
  • 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-23T09:24:31+00:00Added an answer on May 23, 2026 at 9:24 am

    you just need to add a Footer View in the Listyou created. Then for the footer view (might be button/image/text) set a ClickListener for that and in Listener add the items into your list and again refresh the activity. I am adding a little tutorial that will help you in this.

    I used the following Method for Pagination:

    The List Class:

    public class customListView extends Activity implements OnClickListener{
    
      private static class EfficientAdapter extends BaseAdapter {
        private LayoutInflater mInflater;
        Context context;
        public EfficientAdapter(Context context) {
            this.context = context;
            mInflater = LayoutInflater.from(context);
    
        }
    
        public int getCount() {
            return add_Names.size();
        }
    
        public Object getItem(int position) {
        return position;
        }
    
        public long getItemId(int position) {
        return position;
        }
    
        public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
        convertView = mInflater.inflate(R.layout.listcontent, null);
        holder = new ViewHolder();
        holder.text = (TextView) convertView
        .findViewById(R.id.txt1);
        holder.text2 = (TextView) convertView
        .findViewById(R.id.txt2);
        holder.text3 = (TextView) convertView
        .findViewById(R.id.txt3);
    
    
    
        convertView.setTag(holder);
        } else {
        holder = (ViewHolder) convertView.getTag();
        }
    
        holder.text.setText(add_Names.get(position).toString());
        holder.text2.setText(location.get(position).toString());
        holder.text3.setText(details.get(position).toString());
    
        return convertView;
        }
    
        static class ViewHolder {
        TextView text;
        TextView text2;
        TextView text3;
        }
        }//end of efficient Adapter Class
    
        @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listview);
          adapter = new EfficientAdapter(this);
    
        l1 = (ListView) findViewById(R.id.ListView01);
        View footerView = 
            ((LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.layout_footer, null, false);
    
    
        l1.addFooterView(footerView);
    
    
    
        l1.setAdapter(adapter);
        mLayout = (LinearLayout) footerView.findViewById(R.id.footer_layout);
        more = (Button) footerView.findViewById(R.id.moreButton);
        more.setOnClickListener(this);
    
        l1.setOnItemClickListener(new OnItemClickListener() {
    
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
            long arg3) {
            Toast.makeText(getBaseContext(), "You clciked "+add_Names.get(arg2).toString(), Toast.LENGTH_LONG).show();
    
            }
        });            
        }
    
     @Override
        public void onClick(View v) {
            switch(v.getId())
            {
            case R.id.moreButton:
                //Your code to add some more data into list and then call the following to refresh your lits
           adapter.notifyDataSetChanged();
                break;
          }//end of switch
     }//end of onClick
    
    
    }//end of Custom List view class
    

    layout_footerview.xml:(you can add whatever you link in the footer for the list. I used button you can use Text or image or whatever you want)

    <?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:paddingTop="7dip"
     android:paddingBottom="7dip"
     android:orientation="horizontal"
     android:gravity="center">
    <LinearLayout 
    android:id="@+id/footer_layout" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:gravity="center"
    android:layout_gravity="center">
    
    <Button
        android:text="Get more.." 
        android:id="@+id/moreButton" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:textSize="14dip" 
        android:textStyle="bold">
    </Button> 
    
     </LinearLayout>
     </LinearLayout> 
    

    listview.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical" android:layout_width="fill_parent"
      android:layout_height="fill_parent">
    
     <ListView android:id="@+id/ListView01" android:layout_height="wrap_content" 
          android:layout_width="fill_parent">
     </ListView>
    </RelativeLayout>
    

    list-content.xml:(modify as u like to be your list row)

     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent" android:layout_height="wrap_content"
      android:orientation="horizontal">
    
      <ImageView android:id="@+id/image1" android:layout_width="wrap_content"         android:layout_height="wrap_content"
    android:src="@drawable/icon"></ImageView>
    
      <TextView android:layout_width="wrap_content"
      android:layout_height="wrap_content" android:id="@+id/txt1"     android:layout_toRightOf="@+id/image1"
        android:text="Test Description" android:textSize="15dip"  android:textStyle="bold">     
     </TextView>
    
    <TextView android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:id="@+id/txt2"  android:layout_below="@+id/txt1" android:layout_toRightOf="@+id/image1"
    android:text="Address" android:textSize="10dip"></TextView>
    
    <TextView android:layout_width="wrap_content"
    android:layout_height="wrap_content" android:id="@+id/txt3" android:layout_below="@+id/txt2" android:layout_toRightOf="@+id/image1"
    android:text="Details" android:textSize="10dip" ></TextView>
    
       </RelativeLayout>    
    

    I Hop this will definetly help you.!

    Mark this as true and UpVote; if this helps you.

    Thanks
    sHaH..

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

Sidebar

Related Questions

I have the following code to create and apply a few styles for a
i have a web-service that will be returning a collection of System.Drawing.Image objects. My
I have to apply the same data trigger on multiple items. Data trigger is
In jQuery Mobile, you have to apply data attributes to your HTML so jQuery
I have a page that display some data. It is loaded from a database
I have to apply regression function progressively to a time series data (vector time
I have a shape (the red path below) and i have to apply to
I am adding a small view to a linearlayout. I have to apply a
In my application I have apply new outgoing call receiver. It is working fine.
I have to apply a spherical filter on a image in android, 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.