Android APIs
public abstract class

ObjectAdapter

extends Object
java.lang.Object
   ↳ android.support.v17.leanback.widget.ObjectAdapter
Known Direct Subclasses

Class Overview

Adapter for leanback activities. Provides access to a data model and is decoupled from the presentation of the items via PresenterSelector.

Summary

Nested Classes
class ObjectAdapter.DataObserver A DataObserver can be notified when an ObjectAdapter's underlying data changes. 
Constants
int NO_ID Indicates that an id has not been set.
Public Constructors
ObjectAdapter(PresenterSelector presenterSelector)
Construct an adapter with the given PresenterSelector.
ObjectAdapter(Presenter presenter)
Construct an adapter that uses the given Presenter for all items.
ObjectAdapter()
Construct an adapter.
Public Methods
abstract Object get(int position)
Returns the item for the given position.
long getId(int position)
Returns id for the given position.
final Presenter getPresenter(Object item)
Returns the Presenter for the given item from the adapter.
final PresenterSelector getPresenterSelector()
Returns the presenter selector for this ObjectAdapter.
final boolean hasStableIds()
Indicates whether the item ids are stable across changes to the underlying data.
final void registerObserver(ObjectAdapter.DataObserver observer)
Register a DataObserver for data change notifications.
final void setHasStableIds(boolean hasStableIds)
Sets whether the item ids are stable across changes to the underlying data.
final void setPresenterSelector(PresenterSelector presenterSelector)
Set the presenter selector.
abstract int size()
Returns the number of items in the adapter.
final void unregisterAllObservers()
Unregister all DataObservers for this ObjectAdapter.
final void unregisterObserver(ObjectAdapter.DataObserver observer)
Unregister a DataObserver for data change notifications.
Protected Methods
final void notifyChanged()
final void notifyItemRangeChanged(int positionStart, int itemCount)
final void notifyItemRangeInserted(int positionStart, int itemCount)
final void notifyItemRangeRemoved(int positionStart, int itemCount)
void onHasStableIdsChanged()
Called when setHasStableIds(boolean) is called and the status of stable ids has changed.
void onPresenterSelectorChanged()
Called when setPresenterSelector(PresenterSelector) is called and the PresenterSelector differs from the previous one.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int NO_ID

Indicates that an id has not been set.

Constant Value: -1 (0xffffffff)

Public Constructors

public ObjectAdapter (PresenterSelector presenterSelector)

Construct an adapter with the given PresenterSelector.

public ObjectAdapter (Presenter presenter)

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

public ObjectAdapter ()

Construct an adapter.

Public Methods

public abstract Object get (int position)

Returns the item for the given position.

public long getId (int position)

Returns id for the given position.

public final Presenter getPresenter (Object item)

Returns the Presenter for the given item from the adapter.

public final PresenterSelector getPresenterSelector ()

Returns the presenter selector for this ObjectAdapter.

public final boolean hasStableIds ()

Indicates whether the item ids are stable across changes to the underlying data. When this is true, clients of the ObjectAdapter can use getId(int) to correlate Objects across changes.

public final void registerObserver (ObjectAdapter.DataObserver observer)

Register a DataObserver for data change notifications.

public final void setHasStableIds (boolean hasStableIds)

Sets whether the item ids are stable across changes to the underlying data.

public final void setPresenterSelector (PresenterSelector presenterSelector)

Set the presenter selector. May not be null.

public abstract int size ()

Returns the number of items in the adapter.

public final void unregisterAllObservers ()

Unregister all DataObservers for this ObjectAdapter.

public final void unregisterObserver (ObjectAdapter.DataObserver observer)

Unregister a DataObserver for data change notifications.

Protected Methods

protected final void notifyChanged ()

protected final void notifyItemRangeChanged (int positionStart, int itemCount)

protected final void notifyItemRangeInserted (int positionStart, int itemCount)

protected final void notifyItemRangeRemoved (int positionStart, int itemCount)

protected void onHasStableIdsChanged ()

Called when setHasStableIds(boolean) is called and the status of stable ids has changed.

protected void onPresenterSelectorChanged ()

Called when setPresenterSelector(PresenterSelector) is called and the PresenterSelector differs from the previous one.