FastAdapter 0,0,2,1,4,0,6 travis-ci

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

FastAdapter Maven Central Join the chat at

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

Using Maven

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

compile('com.mikepenz:fastadapter:[email protected]') {
    transitive = true

The commons package comes with some useful helpers (which are not needed in all cases) This one for example includes the FastItemAdapter

compile 'com.mikepenz:fastadapter-commons:[email protected]'

All additions are included in the following dependency.

compile 'com.mikepenz:fastadapter-extensions:[email protected]'
//The tiny Materialize library used for its useful helper classes
compile 'com.mikepenz:materialize:[email protected]'

If you upgrade from < 2.5.0 follow the MIGRATION GUIDE

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.

public class SampleItem extends AbstractItem<SampleItem, SampleItem.ViewHolder> {
    public String name;
    public String description;

    //The unique ID for this type of item
    public int getType() {

    //The layout to be used for this type of item
    public int getLayoutRes() {
        return R.layout.sample_item;

    //The logic to bind your data to the view
    public void bindView(ViewHolder viewHolder, List<Object> payloads) {
    	//call super so the selection is already handled for you
    	super.bindView(viewHolder, payloads);
    	//bind our data
        //set the text for the name;
        //set the text for the description or hide

    //reset the view here (this is an optional method, but recommended)
    public void unbindView(ViewHolder holder) {

    //Init the viewHolder for this Item
    public ViewHolder getViewHolder(View v) {
        return new ViewHolder(v);

    //The viewHolder used for this item. This viewHolder is always reused by the RecyclerView so scrolling is blazing fast
    protected static class ViewHolder extends RecyclerView.ViewHolder {
        protected TextView name;
        protected TextView description;

        public ViewHolder(View view) {
   = (TextView) view.findViewById(;
            this.description = (TextView) view.findViewById(;

2. Set the Adapter to the RecyclerView

//create our FastAdapter which will manage everything
FastItemAdapter fastAdapter = new FastItemAdapter();

//set our adapters to the RecyclerView
//we wrap our FastAdapter inside the ItemAdapter -> This allows us to chain adapters for more complex useCases

//set the items to your ItemAdapter

3. Click listener

fastAdapter.withOnClickListener(new FastAdapter.OnClickListener<Item>() {
    public boolean onClick(View v, IAdapter<Item> adapter, Item item, int position) {
       // Handle click here
	return true;

4. Click listeners for views inside your item

//just add an `EventHook` to your `FastAdapter` by implementing either a `ClickEventHook`, `LongClickEventHook`, `TouchEventHook`, `CustomEventHook`
fastItemAdapter.withItemEvent(new ClickEventHook<SampleItem> {
    public View onBind(@NonNull RecyclerView.ViewHolder viewHolder) {
        //return the views on which you want to bind this event
        if (viewHolder instanceof SampleItem.ViewHolder) {
            return ((ViewHolder) viewHolder).view;
        return null;

    public void onClick(View v, int position, FastAdapter<SampleItem> fastAdapter, SampleItem item) {
        //react on the click event

5. Filter

// Call this in onQueryTextSubmit() & onQueryTextChange() when using SearchView

fastAdapter.withFilterPredicate(new IItemAdapter.Predicate<Item>() {
    public boolean filter(Item item, CharSequence constraint) {
	return item.getName().startsWith(String.valueOf(constraint));

filter() will return true to indicate which items will be removed. Returning false indicates items that will be retained.

6. Drag and drop

First, attach ItemTouchHelper to RecyclerView.

SimpleDragCallback dragCallback = new SimpleDragCallback(this);
ItemTouchHelper touchHelper = new ItemTouchHelper(dragCallback);

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

   public boolean itemTouchOnMove(int oldPosition, int newPosition) {
       Collections.swap(fastAdapter.getAdapterItems(), oldPosition, newPosition); // change position
       fastAdapter.notifyAdapterItemMoved(oldPosition, newPosition);
       return true;

7. Using different ViewHolders (like HeaderView)

Start by initializing your adapters:

FastItemAdapter fastAdapter = new FastItemAdapter<>();
// Head is a model class for your header
HeaderAdapter<Header> headerAdapter = new HeaderAdapter<>();

Initialize a generic FastAdapter:

FastItemAdapter<IItem> fastAdapter = new FastItemAdapter<>();

Finally, set the adapter:


It is also possible to add in a third ViewHolder type by using the wrap() method again.


8. Infinite (endless) scrolling

Create a FooterAdapter. We need this to display a loading ProgressBar at the end of our list.

FooterAdapter<ProgressItem> footerAdapter = new FooterAdapter<>();

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

recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener(footerAdapter) {
    public void onLoadMore(int currentPage) {
	footerAdapter.add(new ProgressItem().withEnabled(false));
	// 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 or, read blog post.

Advanced Usage


  • As of v2.5.0 there are no more known requirements to use the FastAdapter with Proguard


The FastAdapter comes with native support for expandable items. These 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 generic 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 Parent, the ViewHolder and the SubItems it will contain as type.

public class SimpleSubExpandableItem extends AbstractExpandableItem<SimpleSubExpandableItem, SimpleSubExpandableItem.ViewHolder, SubItem> {


Libs used in sample app:

Mike Penz: - AboutLibraries - Android-Iconics - ItemAnimators - MaterialDrawer

Other Libs: - Butterknife - Glide - MaterialScrollBar - StickyRecyclerHeadersAdapter

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 2017 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.

Related Repositories



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



demo for this issue: ...



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

Top Contributors

mikepenz FabianTerhorst jasonsparc Rainer-Lang MFlisar shubhamchaudhary rubengees mattiasbe gotev gpulido markus2610 waninkoko Suleiman19 knezmilos13


-   v1.8.2 zip tar
-   v1.8.1 zip tar
-   v1.8.0 zip tar
-   v1.7.0 zip tar
-   v1.6.2 zip tar
-   v1.6.1 zip tar
-   v1.6.0 zip tar
-   v1.5.8 zip tar
-   v1.5.7 zip tar
-   v1.5.6 zip tar
-   v1.5.5 zip tar
-   v1.5.2 zip tar
-   v1.5.1 zip tar
-   v1.5.0 zip tar
-   v1.4.5 zip tar
-   v1.4.4 zip tar
-   v1.4.3 zip tar
-   v1.4.2 zip tar
-   v1.4.1 zip tar
-   v1.4.0 zip tar
-   v1.3.0 zip tar
-   v1.2.9 zip tar
-   v1.2.8 zip tar
-   v1.2.7 zip tar
-   v1.2.6 zip tar
-   v1.2.5 zip tar
-   v1.2.4 zip tar
-   v1.2.3 zip tar
-   v1.2.2 zip tar
-   v1.2.1 zip tar