ListView addHeaderView - top ranked examples from Open Source projects

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

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 
8
CodeRank
This code example shows how to use the following methods:addHeaderView
This code example shows how to use the following methods:setAdapter, addHeaderView
	private void populateHeaderView() { 
		// TODO: Populate the damn header.  
	} 
	 
	private void populateMainView() { 
		listView.addHeaderView(headerView);
		listView.setAdapter(episodeArchiveAdapter);
	} 
	 
	private class LoadEpisodesAsyncTask extends AsyncTask<Void, Void, List<Episode>> {
		@Override 
		protected List<Episode> doInBackground(Void... params) {
			try { 
				return IBClient.getEpisodes(0, 10); 
			} catch (IOException e) {
				e.printStackTrace();
				return null; 
			} 
		} 
		 
4
CodeRank

Related ListView addHeaderView Questions & Answers:

addHeaderView Method Overview
Add a fixed view to appear at the top of the list.
See Code Examples for other Android ListView Methods: