add List Footer View - Android User Interface

Android examples for User Interface:ListView

Description

add List Footer View

Demo Code


//package com.java2s;

import android.view.View;

import android.widget.ListAdapter;
import android.widget.ListView;

public class Main {
    public static void addListFooterView(ListView listView, View footer) {
        // should make sure ListView with adapter before adding footer view.
        ListAdapter adapter = listView.getAdapter();
        if (adapter == null) {
            System.err/*from  w  ww  . ja v a  2  s  .c o m*/
                    .println("Should call setAdapter() before adding footer view.");
        } else {
            if (adapter.getCount() > 0) {
                System.out
                        .println("You can use empty count adapter before adding footer view.");
            }
        }
        listView.addFooterView(footer);
    }
}

Related Tutorials