@Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.one_column) {
      setNumColumns(1);
    } else if (id == R.id.two_columnns) {
      setNumColumns(2);
    } else if (id == R.id.three_columns) {
      setNumColumns(3);
    } else if (id == R.id.four_columns) {
      setNumColumns(4);
    } else if (id == R.id.five_columns) {
      setNumColumns(5);
    } else if (id == R.id.onetwenty_dp_columns) {
      setColumnWidth(120);
    } else if (id == R.id.twoforty_dp_columns) {
      setColumnWidth(240);
    } else if (id == R.id.append_items) {
      adapter.appendItems(demoUtils.moarItems(50));
    } else if (id == R.id.reset_items) {
      demoUtils.currentOffset = 0;
      adapter.setItems(demoUtils.moarItems(50));
    } else if (id == R.id.reordering) {
      listView.setAllowReordering(!listView.isAllowReordering());
      item.setTitle(listView.isAllowReordering() ? "Prevent reordering" : "Allow reordering");
    } else if (id == R.id.debugging) {
      int index = listView.getFirstVisiblePosition();
      View v = listView.getChildAt(0);
      int top = (v == null) ? 0 : v.getTop();

      listView.setDebugging(!listView.isDebugging());
      item.setTitle(listView.isDebugging() ? "Disable debugging" : "Enable debugging");
      listView.setAdapter(adapter);

      listView.setSelectionFromTop(index, top);
    } else if (id == android.R.id.home) {
      drawerLayout.openDrawer(GravityCompat.START);
    }
    return super.onOptionsItemSelected(item);
  }