Best code examples for ListView getAdapter method (android.widget.ListView.getAdapter)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ListView getAdapter method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

ListView getAdapter examples from Open Source projects
This code example shows how to use the following methods: getChildAt, performItemClick, getAdapter
	} 
 
	@Test 
	public void is_item_click_available_from_list_fragment() { 
		ListView listView = (ListView) myListFragment.findViewById(android.R.id.list);
		long itemId = listView.getAdapter().getItemId(TESTED_CLICKED_INDEX);
		View view = listView.getChildAt(TESTED_CLICKED_INDEX);
 
		assertThat(myListFragment.listItemClicked).isFalse();
		listView.performItemClick(view, TESTED_CLICKED_INDEX, itemId);
		assertThat(myListFragment.listItemClicked).isTrue();
	} 
 
	public static void startFragment(Fragment fragment) {
		FragmentManager fragmentManager = new FragmentActivity().getSupportFragmentManager();
		FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
		fragmentTransaction.add(fragment, null);
		fragmentTransaction.commit();
	} 
} 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setOnTouchListener, setOnScrollListener, getAdapter, setAdapter
8
CodeRank
This code example shows how to use the following methods: getChildAt, getChildCount, getListPaddingTop, getAdapter
                newLastChild.getId());
    } 
     
    @LargeTest 
    public void testShortScroll() { 
        View firstChild = mListView.getChildAt(0);
        if (firstChild.getTop() < this.mListView.getListPaddingTop()) {
            firstChild = mListView.getChildAt(1);
        } 
             
        View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
         
        int lastTop = lastChild.getTop();
         
        TouchUtils.dragViewBy(this, firstChild, Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL,
                0, ViewConfiguration.getTouchSlop() + 1 + 10);
         
        View newLastChild = mListView.getChildAt(mListView.getChildCount() - 1);
         
        assertEquals("View scrolled to wrong position", lastTop, newLastChild.getTop() - 10);

8
CodeRank
This code example shows how to use the following methods: scrollToBottom, getHeight, getChildAt, getChildCount, getListPaddingBottom
                firstChild.getTop());
    } 
     
    @LargeTest 
    public void testPushUp() { 
        int originalCount = mListView.getChildCount();
         
        TouchUtils.scrollToBottom(this, mListView);
 
        // Nothing should be selected 
        assertEquals("Selection still available after touch", -1, 
                mListView.getSelectedItemPosition());
 
        View lastChild = mListView.getChildAt(mListView.getChildCount() - 1);
 
        assertEquals("List is not scrolled to the bottom", mListView.getAdapter().getCount() - 1,
                lastChild.getId());
 
        assertEquals("Last item is not touching the bottom edge",  
                mListView.getHeight() - mListView.getListPaddingBottom(), lastChild.getBottom());

7
CodeRank
This code example shows how to use the following methods: getLayoutParams, setLayoutParams, getAdapter, getDividerHeight
Related ListView getAdapter Questions & Answers:
getAdapter Method Overview
Returns the adapter currently in use in this ListView.
See Code Examples for other Android ListView Methods: