SearchAdapter

public class SearchAdapter<T extends Listable> extends ArrayAdapter<T> implements Filterable

Populates a displayed list with items

Parameters:
  • <T> – Type of item to put in the list

Constructors

SearchAdapter

public SearchAdapter(Context context, int resource, int listViewID, List<T> items)

Initialize instance fields with provided parameters

Parameters:

SearchAdapter

SearchAdapter(Context context, int resource, int listViewID)

Initialize context variables without a starting list

Parameters:
  • context – application context
  • resource – int resource layout id

Methods

addAll

public void addAll(Collection<? extends T> collection)

Add all items in a Collection to the list of items the adapter displays in the list

Parameters:
  • collection – Items to add to the list

clear

public void clear()

Clears the list of all items

getItem

public T getItem(int position)

Get the item associated with the list entry at a certain position

Parameters:
  • position – Position of list item
Returns:

The object represented at the specified position

getView

public View getView(int position, View convertView, ViewGroup parent)

Get a View for the list

Parameters:
  • position – Position of list element to get the View for
  • convertViewView inflated from R.layout.network_list_item that will represent the list entry
  • parent – Parent of the created View
Returns:

Inflated View for an element of the list