Code example for Button

Methods: isFocused

0
    public void DISABLE_testLeaveTouchModeWithDpadEvent() { 
        assertInTouchModeAfterClick(this, mFirstButton);
 
        assertTrue("should be in touch mode", mActivity.isInTouchMode());
        assertFalse("button should not have focus when touched",
                mFirstButton.isFocused());
 
        assertNotInTouchModeAfterKey(this, KeyEvent.KEYCODE_DPAD_RIGHT, mFirstButton);
        assertFalse("should be out of touch mode", mActivity.isInTouchMode());
        assertTrue("first button (the top most focusable) should have gained focus",
                mFirstButton.isFocused());
    } 
 
 
}