Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

ClassPresenterSelector

class ClassPresenterSelector : PresenterSelector
kotlin.Any
   ↳ androidx.leanback.widget.PresenterSelector
   ↳ androidx.leanback.widget.ClassPresenterSelector

A ClassPresenterSelector selects a Presenter based on the item's Java class.

Summary

Public constructors

A ClassPresenterSelector selects a Presenter based on the item's Java class.

Public methods

ClassPresenterSelector!
addClassPresenter(cls: Class<*>!, presenter: Presenter!)

Sets a presenter to be used for the given class.

ClassPresenterSelector!
addClassPresenterSelector(cls: Class<*>!, presenterSelector: PresenterSelector!)

Sets a presenter selector to be used for the given class.

Presenter!
getPresenter(item: Any!)

Array<Presenter!>!

Public constructors

<init>

ClassPresenterSelector()

A ClassPresenterSelector selects a Presenter based on the item's Java class.

Public methods

addClassPresenter

fun addClassPresenter(cls: Class<*>!, presenter: Presenter!): ClassPresenterSelector!

Sets a presenter to be used for the given class.

Parameters
cls Class<*>!: The data model class to be rendered.
presenter Class<*>!: The presenter that renders the objects of the given class.
Return
ClassPresenterSelector!: This ClassPresenterSelector object.

addClassPresenterSelector

fun addClassPresenterSelector(cls: Class<*>!, presenterSelector: PresenterSelector!): ClassPresenterSelector!

Sets a presenter selector to be used for the given class.

Parameters
cls Class<*>!: The data model class to be rendered.
presenterSelector Class<*>!: The presenter selector that finds the right presenter for a given class.
Return
ClassPresenterSelector!: This ClassPresenterSelector object.

getPresenter

fun getPresenter(item: Any!): Presenter!

getPresenters

fun getPresenters(): Array<Presenter!>!