Android APIs
public class

ArrayObjectAdapter

extends ObjectAdapter
java.lang.Object
   ↳ android.support.v17.leanback.widget.ObjectAdapter
     ↳ android.support.v17.leanback.widget.ArrayObjectAdapter

Class Overview

An ObjectAdapter implemented with an ArrayList.

Summary

[Expand]
Inherited Constants
From class android.support.v17.leanback.widget.ObjectAdapter
Public Constructors
ArrayObjectAdapter(PresenterSelector presenterSelector)
Construct an adapter with the given PresenterSelector.
ArrayObjectAdapter(Presenter presenter)
Construct an adapter that uses the given Presenter for all items.
ArrayObjectAdapter()
Construct an adapter.
Public Methods
void add(int index, Object item)
Inserts an item into this adapter at the specified index.
void add(Object item)
Adds an item to the end of the adapter.
void addAll(int index, Collection items)
Adds the objects in the given collection to the adapter, starting at the given index.
void clear()
Removes all items from this adapter, leaving it empty.
Object get(int index)
Returns the item for the given position.
int indexOf(Object item)
Returns the index for the first occurrence of item in the adapter, or -1 if not found.
void notifyArrayItemRangeChanged(int positionStart, int itemCount)
Notify that the content of a range of items changed.
boolean remove(Object item)
Removes the first occurrence of the given item from the adapter.
int removeItems(int position, int count)
Removes a range of items from the adapter.
int size()
Returns the number of items in the adapter.
[Expand]
Inherited Methods
From class android.support.v17.leanback.widget.ObjectAdapter
From class java.lang.Object

Public Constructors

public ArrayObjectAdapter (PresenterSelector presenterSelector)

Construct an adapter with the given PresenterSelector.

public ArrayObjectAdapter (Presenter presenter)

Construct an adapter that uses the given Presenter for all items.

public ArrayObjectAdapter ()

Construct an adapter.

Public Methods

public void add (int index, Object item)

Inserts an item into this adapter at the specified index.

Parameters
index The index at which the item should be inserted.
item The item to insert into the adapter.

public void add (Object item)

Adds an item to the end of the adapter.

Parameters
item The item to add to the end of the adapter.

public void addAll (int index, Collection items)

Adds the objects in the given collection to the adapter, starting at the given index.

Parameters
index The index at which the items should be inserted.
items A Collection of items to insert.

public void clear ()

Removes all items from this adapter, leaving it empty.

public Object get (int index)

Returns the item for the given position.

public int indexOf (Object item)

Returns the index for the first occurrence of item in the adapter, or -1 if not found.

Parameters
item The item to find in the list.
Returns
  • Index of the first occurrence of the item in the adapter, or -1 if not found.

public void notifyArrayItemRangeChanged (int positionStart, int itemCount)

Notify that the content of a range of items changed. Note that this is not same as items being added or removed.

Parameters
positionStart The position of first item that has changed.
itemCount The count of how many items have changed.

public boolean remove (Object item)

Removes the first occurrence of the given item from the adapter.

Parameters
item The item to remove from the adapter.
Returns
  • True if the item was found and thus removed from the adapter.

public int removeItems (int position, int count)

Removes a range of items from the adapter. The range is specified by giving the starting position and the number of elements to remove.

Parameters
position The index of the first item to remove.
count The number of items to remove.
Returns
  • The number of items removed.

public int size ()

Returns the number of items in the adapter.