Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>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. </p> <p>I used the following Method for Pagination:</p> <p>The List Class:</p> <pre><code>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&lt;?&gt; 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 </code></pre> <p><strong>layout_footerview.xml:</strong>(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) </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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"&gt; &lt;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"&gt; &lt;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"&gt; &lt;/Button&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>listview.xml:</strong> </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;ListView android:id="@+id/ListView01" android:layout_height="wrap_content" android:layout_width="fill_parent"&gt; &lt;/ListView&gt; &lt;/RelativeLayout&gt; </code></pre> <p><strong>list-content.xml:</strong>(modify as u like to be your list row)</p> <pre><code> &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"&gt; &lt;ImageView android:id="@+id/image1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon"&gt;&lt;/ImageView&gt; &lt;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"&gt; &lt;/TextView&gt; &lt;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"&gt;&lt;/TextView&gt; &lt;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" &gt;&lt;/TextView&gt; &lt;/RelativeLayout&gt; </code></pre> <p>I Hop this will definetly help you.!</p> <p>Mark this as true and UpVote; if this helps you.</p> <p>Thanks sHaH..</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload