Android 12 Developer Preview is here! Try it out, and give us your feedback!


open class SparseArrayObjectAdapter : ObjectAdapter
   ↳ androidx.leanback.widget.ObjectAdapter
   ↳ androidx.leanback.widget.SparseArrayObjectAdapter

An ObjectAdapter implemented with a android.util.SparseArray. This class maintains an array of objects where each object is associated with an integer key which determines its order relative to other objects.


Inherited constants
Public constructors
<init>(presenterSelector: PresenterSelector!)

Constructs an adapter with the given PresenterSelector.

<init>(presenter: Presenter!)

Constructs an adapter with the given Presenter.

Constructs an adapter.

Public methods
open Unit
clear(key: Int)

Clears the given key and associated item from the adapter.

open Unit

Removes all items from this adapter, leaving it empty.

open Any!
get(position: Int)

open Int
indexOf(item: Any!)

Returns the index for the given item in the adapter.

open Int
indexOf(key: Int)

Returns the index for the given key in the adapter.

open Boolean

open Any!
lookup(key: Int)

Returns the object for the given key, or null if no mapping for that key exists.

open Unit
notifyArrayItemRangeChanged(positionStart: Int, itemCount: Int)

Notify that the content of a range of items changed.

open Unit
set(key: Int, item: Any!)

Sets the item for the given key.

open Int

Inherited functions