You are currently viewing Implementing bottom navigation view in Organizer App

Implementing bottom navigation view in Organizer App

The state of the app before merging the pull request: #1009 was a simple RecyclerView with StickyHeaders from FastAdapter library.

We needed the app to look more like EventBrite so that we could help the users smoothly transition from EventBrite to Open Event Organizer Android App.

Eventbrite was using Tabs with View Pagers, which is a lot tedious because of its bugginess. View Pagers are buggy and would further require unnecessary architectural changes and additional classes for the Event-list module. This issue was raised in the last GSoC as well, but developers settled with using a single list view.

Using View Pagers requires managing presenters for each of the fragments being used.

So my mentor wanted us to use BottomNavigationView instead. In fact, this was the best solution we could come up with, and we’ll see why:

Step 1: Add BottomNavigationView to the layout:


The above code for the layout is added to the end of fragment_event_list.xml and is to just add the Bottom Navigation layout for the xml. The attribute   app:menu takes the reference to the menu resource layout for the menu items to be used, which we’ll setup next:

Step 2: Declaring menu resource file for the BottomNavigationView:

The menu resource file is used to specify what items we need in the BottomNavigationView.

<?xml version=“1.0” encoding=“utf-8”?>
<menu xmlns:android=“”>
   <item android:id=“@+id/action_live”
   <item android:id=“@+id/action_upcoming”
   <item android:id=“@+id/action_past”

Step 3: Implement Filterable in Adapter:

Filterable is an interface which is generally used with an adapter when there are many different values possible for the adapter.

class EventsListAdapter extends RecyclerView.Adapter<EventsListAdapter.EventRecyclerViewHolder> implements StickyRecyclerHeadersAdapter<HeaderViewHolder>, Filterable {

Filterable requires overriding the method: getFilter() which as the name suggests, provide the filter logic to be used.

public Filter getFilter() {
   return new Filter() {
       protected FilterResults performFiltering(CharSequence constraint) {
           for (Event event : events) {
               try {
                   String category = DateService.getEventStatus(event);
                   if (constraint.toString().equalsIgnoreCase(category))
               } catch (ParseException e) {
           return null;
        protected void publishResults(CharSequence constraint, FilterResults results) {

Step 4: Setting up the BottomViewNavigation:

We have already set up the binding so we can reference the bottomNavigationView directly and setup the OnNavigationItemSelectedListener as follows:

           item -> {
               switch (item.getItemId()) {
                       return true;
                       return true;
                       return true;
                      return false;

As can be seen above, we can directly filter according to the string parameters we are passing and the logic is being handled in the getFilter() method.

This is the result of the making the above changes:

The best benefits of using  BottomNavigationView  was that we didn’t even had to touch the presenter code to handle event list, or create any new fragments. This was one of the cleanest possible solutions, but now we have a pager implemented in the app, which seems to give a little bit more visual appeal.


Open Event Organizer App – Pull Request #1009

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.