FileDocCategorySizeDatePackage
ListWithFooterViewAndNewLabels.javaAPI DocAndroid 5.1 API3296Thu Mar 12 22:22:12 GMT 2015android.widget.focus

ListWithFooterViewAndNewLabels

public class ListWithFooterViewAndNewLabels extends android.app.ListActivity

Fields Summary
private MyAdapter
mMyAdapter
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        setContentView(R.layout.list_with_button_above);

        Button footerButton = new Button(this);
        footerButton.setText("hi");
        footerButton.setLayoutParams(
                new AbsListView.LayoutParams(
                        ViewGroup.LayoutParams.WRAP_CONTENT,
                        ViewGroup.LayoutParams.WRAP_CONTENT));
        getListView().addFooterView(footerButton);

        mMyAdapter = new MyAdapter(this);
        setListAdapter(mMyAdapter);

        // not in list
        Button topButton = (Button) findViewById(R.id.button);
        topButton.setText("click to add new item");
        topButton.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                mMyAdapter.addLabel("yo");
            }
        });

        mMyAdapter.addLabel("first");