The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...

View the Project on GitHub mikepenz/FastAdapter

FastAdapter Download

The RecyclerView is one of the most used widgets in the Android world, and with it you have to implement an Adapter which provides the items for the view. Most use cases require the same base logic, but require you to write everything again and again.

The FastAdapter is here to simplify this process. You don’t have to worry about the adapter anymore. Just write the logic for how your view/item should look like, and you are done. This library has a fast and highly optimized core which provides core functionality, most apps require. It also prevents common mistakes by taking away those steps from the devs. Beside being blazing fast, minimizing the code you need to write, it is also really easy to extend. Just provide another adapter implementation, hook into the adapter chain, custom select / deselection behaviors. Everything is possible.

A quick overview:



You can try it out here Google Play (or download the latest release from GitHub)



Include in your project

Latest releases

Using Maven

The library is split up into core, commons, and extensions. The core functions are included in the following dependency.

implementation 'com.mikepenz:fastadapter:${latestFastAdapterRelease}'
implementation "androidx.appcompat:appcompat:${androidX}"
implementation "androidx.recyclerview:recyclerview:${androidX}"

Expandable support is included and can be added via this

implementation 'com.mikepenz:fastadapter-extensions-expandable:${latestFastAdapterRelease}'
//The tiny Materialize library used for its useful helper classes
implementation 'com.mikepenz:materialize:${latestVersion}' // at least 1.2.0

Many helper classes are included in the following dependency.

implementation 'com.mikepenz:fastadapter-extensions-diff:${latestFastAdapterRelease}' // diff util helpers
implementation 'com.mikepenz:fastadapter-extensions-drag:${latestFastAdapterRelease}' // drag support
implementation 'com.mikepenz:fastadapter-extensions-scroll${latestFastAdapterRelease}' // scroll helpers
implementation 'com.mikepenz:fastadapter-extensions-swipe:${latestFastAdapterRelease}' // swipe support
implementation 'com.mikepenz:fastadapter-extensions-ui:${latestFastAdapterRelease}' // pre-defined ui components
implementation 'com.mikepenz:fastadapter-extensions-utils:${latestFastAdapterRelease}' // needs the `expandable`, `drag` and `scroll` extension.

// required for the ui components and the utils
implementation "${androidX}"
//The tiny Materialize library used for its useful helper classes
implementation 'com.mikepenz:materialize:${latestVersion}' // at least 1.2.0


Major release, migrates fully to Kotlin. Check out the changelog or the [MIGRATION GUIDE]( for more details

How to use

1. Implement your item (the easy way)

Just create a class which extends the AbstractItem as shown below. Implement the methods, and your item is ready.

open class SimpleItem : AbstractItem<SimpleItem.ViewHolder>() {
    var name: String? = null
    var description: String? = null

    /** defines the type defining this item. must be unique. preferably an id */
    override val type: Int
        get() =

    /** defines the layout which will be used for this item in the list  */
    override val layoutRes: Int
        get() = R.layout.sample_item

    override fun getViewHolder(v: View): ViewHolder {
        return ViewHolder(v)

    class ViewHolder(view: View) : FastAdapter.ViewHolder<SimpleItem>(view) {
        var name: TextView = view.findViewById(
        var description: TextView = view.findViewById(

        override fun bindView(item: SimpleItem, payloads: MutableList<Any>) {
            name.text =
            description.text =

        override fun unbindView(item: SimpleItem) {
            name.text = null
            description.text = null

2. Set the Adapter to the RecyclerView

//create the ItemAdapter holding your Items
val itemAdapter = ItemAdapter<SimpleItem>()
//create the managing FastAdapter, by passing in the itemAdapter
val fastAdapter = FastAdapter.with(itemAdapter)

//set our adapters to the RecyclerView

//set the items to your ItemAdapter

3. Extensions

By default the FastAdapter only provides basic functionality, which comes with the abstraction of items as Item and Model. And the general functionality of adding/removing/modifying elements. To enable selections, or expandables the provided extensions need to be activated.

3.1. SelectExtension

// Gets (or creates and attaches if not yet existing) the extension from the given `FastAdapter`
val selectExtension = fastAdapter.getSelectExtension()
// configure as needed
selectExtension.isSelectable = true
selectExtension.multiSelect = true
selectExtension.selectOnLongClick = false
// see the API of this class for more options.

3.2. ExpandableExtension

This requires the fastadapter-extensions-expandable extension.

// Gets (or creates and attaches if not yet existing) the extension.
val expandableExtension = fastAdapter.getExpandableExtension()
// configure as needed
expandableExtension.isOnlyOneExpandedItem = true

For further details scroll down to the ExpandableItems (under advanced usage) section.

3. Click listener

fastAdapter.onClickListener = { view, adapter, item, position ->
       // Handle click here

4. Click listeners for views inside your item

//just add an `EventHook` to your `FastAdapter` by implementing either a `ClickEventHook`, `LongClickEventHook`, `TouchEventHook`, `CustomEventHook`
fastAdapter.addEventHook(object : ClickEventHook<SimpleImageItem>() {
    override fun onBind(viewHolder: RecyclerView.ViewHolder): View? {
        //return the views on which you want to bind this event
        return if (viewHolder is SimpleImageItem.ViewHolder) {
        } else null

    override fun onClick(v: View, position: Int, fastAdapter: FastAdapter<SimpleImageItem>, item: SimpleImageItem) {
        //react on the click event

5. Filter

// Call this in onQueryTextSubmit() & onQueryTextChange() when using SearchView
itemAdapter.itemFilter.filterPredicate = { item: SimpleItem, constraint: CharSequence? ->

filter() should return true for items to be retained and false for items to be removed.

6. Drag and drop

This requires the fastadapter-extensions-drag extension.

First, attach ItemTouchHelper to RecyclerView.

val dragCallback = SimpleDragCallback()
val touchHelper = ItemTouchHelper(dragCallback)

Implement ItemTouchCallback interface in your Activity, and override the itemTouchOnMove() method.

override fun itemTouchOnMove(oldPosition: Int, newPosition: Int): Boolean {
    DragDropUtil.onMove(fastItemAdapter.itemAdapter, oldPosition, newPosition) // change position
    return true

7. Using different ViewHolders (like HeaderView)

Start by initializing your adapters:

// Head is a model class for your header
val headerAdapter = ItemAdapter<Header>()

Initialize a Model FastAdapter:

val itemAdapter = GenericItemAdapter()

Finally, set the adapter:

val fastAdapter: GenericFastAdapter = FastAdapter.with(headerAdapter, itemAdapter) //the order defines in which order the items will show up
// alternative the super type of both item adapters can be used. e.g.:

8. Infinite (endless) scrolling

Create a FooterAdapter. We need this to display a loading ProgressBar at the end of our list. (Don’t forget to pass it into FastAdapter.with(..))

val footerAdapter = ItemAdapter<ProgressItem>()

Keep in mind that ProgressItem is provided by FastAdapter’s extensions.

recyclerView.addOnScrollListener(object : EndlessRecyclerOnScrollListener(footerAdapter) {
     override fun onLoadMore(currentPage: Int) {
	// Load your items here and add it to FastAdapter

For the complete tutorial and more features such as multi-select and CAB check out the sample app.

Advanced Usage



The FastAdapter comes with support for expandable items. After adding the dependency set up the Expandable extension via:

val expandableExtension = fastAdapter.getExpandableExtension()

Expandable items have to implement the IExpandable interface, and the sub items the ISubItem interface. This allows better support. The sample app provides sample implementations of those. (Those in the sample are kept Model which allows them to be used with different parent / subitems)

As of the way how SubItems and their state are handled it is highly recommended to use the identifier based StateManagement. Just add withPositionBasedStateManagement(false) to your FastAdapter setup.

A simple item just needs to extend from the AbstractExpandableItem and provide the ViewHolder as type.

open class SimpleSubExpandableItem : AbstractExpandableItem<SimpleSubExpandableItem.ViewHolder>() {


// See the of the sample application for more details.


Libs used in sample app:

Mike Penz:

Other Libs:

Developed By


This free, open source software was also made possible by a group of volunteers that put many hours of hard work into it. See the file for details.

Special mentions

I want to give say thanks to some special contributors who provided some huge PRs and many changes to improve this great library.


Copyright 2019 Mike Penz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.