FileDocCategorySizeDatePackage
ListSetSelection.javaAPI DocAndroid 1.5 API2209Wed May 06 22:42:02 BST 2009com.android.frameworktest.listview

ListSetSelection

public class ListSetSelection extends com.android.frameworktest.util.ListScenario
List of 1,000 items used to test calls to setSelection() in touch mode. Pressing the S key will call setSelection(0) on the list.

Fields Summary
private android.widget.Button
mButton
Constructors Summary
Methods Summary
public booleandispatchKeyEvent(android.view.KeyEvent event)

        if (event.getKeyCode() == KeyEvent.KEYCODE_S) {
            getListView().setSelection(0);
            return true;
        }

        return super.dispatchKeyEvent(event);
    
public android.widget.ButtongetButton()

        return mButton;
    
protected voidinit(Params params)

        params.setStackFromBottom(false)
                .setStartingSelectionPosition(-1)
                .setNumItems(1000)
                .setItemScreenSizeFactor(0.22);
    
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        mButton = new Button(this);
        mButton.setText("setSelection(0)");
        mButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                getListView().setSelection(0);
            }
        });

        getListViewContainer().addView(mButton, new LinearLayout.LayoutParams(
                LinearLayout.LayoutParams.FILL_PARENT,
                LinearLayout.LayoutParams.WRAP_CONTENT
        ));