private void changeListVisualization(MenuItem menuItem) {
   if (isListView) {
     staggeredGridLayoutManager.setSpanCount(2);
     menuItem.setIcon(R.drawable.ic_action_list);
     menuItem.setTitle(R.string.menu_show_as_list);
     isListView = false;
   } else {
     staggeredGridLayoutManager.setSpanCount(1);
     menuItem.setIcon(R.drawable.ic_action_grid);
     menuItem.setTitle(R.string.menu_show_as_grid);
     isListView = true;
   }
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // For larger devices (like tablets), it creates more columns.
    int columnsNumber = getActivity().getResources().getInteger(R.integer.restaurant_columns);
    if (mStaggeredGridLayoutManager == null) {
      mStaggeredGridLayoutManager =
          new StaggeredGridLayoutManager(columnsNumber, StaggeredGridLayoutManager.VERTICAL);
    } else {
      mStaggeredGridLayoutManager.setSpanCount(columnsNumber);
    }
  }