FileDocCategorySizeDatePackage
List8.javaAPI DocGoogle Android v1.5 Example4183Sun Nov 11 13:01:04 GMT 2007com.google.android.samples.view

List8

public class List8 extends android.app.ListActivity
A list view that demonstrates the use of setEmptyView. This example alos uses a custom layout file that adds some extra buttons to the screen.

Fields Summary
PhotoAdapter
mAdapter
Constructors Summary
Methods Summary
public voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        // Use a custom layout file
        setContentView(R.layout.list_8);
        
        // Tell the list view which view to display when the list is empty
        getListView().setEmptyView(findViewById(R.id.empty));
        
        // Set up our adapter
        mAdapter = new PhotoAdapter(this);
        setListAdapter(mAdapter);
        
        // Wire up the clear button to remove all photos
        Button clear = (Button) findViewById(R.id.clear);
        clear.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                mAdapter.clearPhotos();
            } });
        
        // Wire up the add button to add a new photo
        Button add = (Button) findViewById(R.id.add);
        add.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                mAdapter.addPhotos();
            } });