Code example for GridView

Methods: getSelectedItemPosition

0
    @MediumTest 
    public void testPreconditions() { 
        assertNotNull(mActivity);
        assertNotNull(mGridView);
 
        assertEquals(0, mGridView.getSelectedItemPosition());
    } 
 
    @MediumTest 
    public void testNoScroll() { 
        View firstChild = mGridView.getChildAt(0);
        View lastChild = mGridView.getChildAt(mGridView.getChildCount() - 1);
         
        int firstTop = firstChild.getTop();
         
        TouchUtils.dragViewBy(this, lastChild, Gravity.TOP | Gravity.LEFT, 
                0, -(ViewConfiguration.getTouchSlop()));
         
        View newFirstChild = mGridView.getChildAt(0);
         
Contextual code suggestions in your IDE  Get Codota for Java