Android ListView - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ListView class.

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
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setFastScrollEnabled, setDividerHeight
 
    } 
 
    @Override 
    protected void configureList(Activity activity, ListView listView) {
        super.configureList(activity, listView);
 
        listView.setFastScrollEnabled(true);
        listView.setDividerHeight(0);
 
        getListAdapter() 
                .addHeader(activity.getLayoutInflater()
                        .inflate(R.layout.news_list_item_labels, null));
    } 
 
    @Override 
    LogoutService getLogoutService() { 
        return logoutService;
    } 
 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getLeft, getRight, getTop
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addHeaderView, setAdapter, setEmptyView, setFocusable, setOnItemClickListener
		super.onCreate(savedInstanceState);
 
		if (listViewId != 0) {
			listView = findListViewById(listViewId);
			if (headerView() != null) { 
				listView.addHeaderView(headerView());
			} 
			listView.setOnItemClickListener(this);
			android.view.View emptyView = findViewById(android.R.id.empty);
			if (emptyView != null) {
				listView.setEmptyView(emptyView);
			} 
 
			adapter = Objects.createInstance(adapterClass, Context.class, this);
			listView.setAdapter(adapter);
			listView.setFocusable(true);
		} 
	} 
 
	/** 
	 * Called after ListAdapter has been loaded 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: addFooterView, getFooterViewsCount, setAdapter, setSelection
        mDataIterator = pullRequestService.pagePullRequests(new RepositoryId(mRepoOwner, mRepoName), mState);
    } 
     
    private void fillData(List<PullRequest> pullRequests) {
        if (pullRequests != null && !pullRequests.isEmpty()) {
            if (mListView.getFooterViewsCount() == 0) {
                mListView.addFooterView(mLoadingView);
                mListView.setAdapter(mAdapter);
            } 
            if (isLoadMore) {
                mAdapter.addAll(mAdapter.getCount(), pullRequests);
                mAdapter.notifyDataSetChanged();
            } 
            else { 
                mAdapter.clear();
                mAdapter.addAll(pullRequests);
                mAdapter.notifyDataSetChanged();
                mListView.setSelection(0);
            } 
        } 

9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android ListView Questions & Answers:

Other Android ListView Examples

1:	
2:	// Creating a button - Load More
3:	Button btnLoadMore = new Button(this);
-
1:	
2:	// Creating a button - Load More
3:	Button btnLoadMore = new Button(this);

Read More

14:		
15:		// List view
16:		private ListView lv;
17:		
18:		// Listview Adapter
-
36:	        						"Samsung Galaxy S3", "MacBook Air", "Mac Mini", "MacBook Pro"};
37:	        
38:	        lv = (ListView) findViewById(R.id.list_view);
39:	        inputSearch = (EditText) findViewById(R.id.inputSearch);
40:

Read More

21:	        this.setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, R.id.label, adobe_products));
22:	        
23:	        ListView lv = getListView();
24:	
25:	        // listening to single list item on click

Read More

1:	ListView listView = (ListView) findViewById(R.id.listview);
2:	listView.setAdapter(adapter);
3:	
-
1:	ListView listView = (ListView) findViewById(R.id.listview);
2:	listView.setAdapter(adapter);
3:

Read More

1:	ListView listView = getListView();
2:	listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL);
3:	listView.setMultiChoiceModeListener(new MultiChoiceModeListener() {

Read More

69:	
70:	    @Override 
71:	    public void onListItemClick(ListView l, View v, int position, long id) {
72:	        // Do something when a list item is clicked
73:	    }

Read More

See Code Examples for Android ListView Methods: