Code example for Spinner

Methods: requestFocus, setSelection

0
         * contains the Java statements put in it by its run() method. 
         */ 
        mActivity.runOnUiThread(
            new Runnable() {
                public void run() { 
                    mSpinner.requestFocus();
                    mSpinner.setSelection(INITIAL_POSITION);
                } 
            } 
        ); 
 
        // Activate the spinner by clicking the center keypad key 
 
        this.sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
 
        // send 5 down arrow keys to the spinner 
 
        for (int i = 1; i <= TEST_POSITION; i++) {
 
            this.sendKeys(KeyEvent.KEYCODE_DPAD_DOWN);
        }