Code example for Button

Methods: isFocused

0
    } 
 
    @MediumTest 
    public void testGoingRightFromLeftButtonJumpsOverCenterToRight() { 
        sendKeys(KeyEvent.KEYCODE_DPAD_RIGHT);
        assertTrue("right button should be focused", mRightButton.isFocused());
    } 
 
    @MediumTest 
    public void testGoingLeftFromRightButtonGoesToCenter()  { 
        // Give right button focus by having it request focus.  We post it 
        // to the UI thread because we are not running on the same thread, and 
        // any direct api calls that change state must be made from the UI thread. 
        // This is in contrast to instrumentation calls that send events that are 
        // processed through the framework and eventually find their way to 
        // affecting the ui thread. 
        getActivity().runOnUiThread(new Runnable() {
            public void run() { 
                mRightButton.requestFocus();
            } 
        });