Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Recycler ELE

Release Download

Logo image

Related Blog Post: Cybersapien's blog

We often use the RecyclerView and the RecyclerView.Adapter for our material design apps. Going from the ListView to RecyclerView, I really missed the setEmptyView() method.

So, I extended the original RecyclerView Adapter to help manage different states in the application. The Adapter, apart from the standard list, supports three different views:

  • Loading View (While Data is being fetched)
  • Empty View (When there is not data)
  • Error View (In case of an error while fetching data)

This way, RecyclerELE helps us give different output to user depending on the current state of data, without having to mess a lot with the code.


The installation is pretty easy.


For Gradle

In your app module's build.gradle add dependency:

    compile 'com.github.the-cybersapien:recyclerELE:(latest release)'
For Maven:

Add Snippet:


Jitpack Gradle

In your project's build.gradle at the end of the repositories, add:

allprojects {
    repositories {
        maven { url '' }

In your app module's build.gradle add dependency:

    compile 'com.github.the-cybersapien:recyclerELE:(latest release)'


In your Activity, create a regular RecyclerView.Adapter for your List Item

    RecyclerAdapter listAdapter = new RecyclerAdapter(Object... args);

Get the reference to your RecyclerView

    RecyclerView recyclerView = (RecyclerView) findViewById(;

Inflate your empty view, loading view and error view with the recyclerView as their parent programmatically.

    View loadingView = getLayoutInflator().inflate(R.layout.view_loading, recyclerView, false);
    View emptyView = getLayoutInflator().inflate(R.layout.view_empty, recyclerView, false);
    View errorView = getLayoutInflator().inflate(R.layout.view_error, recyclerView, false);

Initialize the RecyclerELEAdapter with the RecyclerAdapter and the different Views

    RecyclerELEAdapter recyclerELEAdapter = new RecyclerELE(listAdapter, emptyView, loadingView, errorView);

Set the RecyclerELEAdapter to your recyclerView


Change the current View type of the adapter with setCurrentView() function

    // Normal List View
    // Empty View
    // Loading View
    // Error View

For more details, see the Sample Application in recyclerELE sample module.


Copyright [2017] [Aditya Aggarwal]

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, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You can’t perform that action at this time.