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

Gallery2

public class Gallery2 extends android.app.Activity

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

        super.onCreate(icicle);
        setContentView(R.layout.gallery_2);

        // Get a cursor with all people
        Cursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null);
        startManagingCursor(c);
        
        GalleryAdapter adapter = new MyCursorAdapter(this,
        // Use a template that displays a text view
                android.R.layout.simple_gallery_item,
                // Give the cursor to the list adatper
                c,
                // Map the NAME column in the people database to...
                new String[] {People.NAME},
                // The "text1" view defined in the XML template
                new int[] { android.R.id.text1 });

        Gallery g = (Gallery) findViewById(R.id.gallery);
        g.setAdapter(adapter);