title: Android Toolbar item OnClickListener
body: <p>I have a Toolbar and an item (add) which, when clicked, adds a view in listView below. However, the <code>onOptionsItemSelected</code> gives you the effect of a single click so it only adds one view, and in my case, I need multiple views, thus multiple clicks are required. How do I set up everything so that the item behaves as an <code>onClickListener</code> rather than a single click?</p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(MenuItem item) {
      int id = item.getItemId();
  
      if (id == R.id.addButton){
          final TextView noProject = (TextView) findViewById(R.id.NOPROJECT);
  
          final ArrayList&lt;String&gt; listItems=new ArrayList&lt;String&gt;();
          final ListAdapter addAdapter = new ArrayAdapter&lt;String&gt;(this,
                      R.layout.list_item, R.id.listFrame, listItems);
          final ListView lv = (ListView) findViewById(R.id.lv);
          lv.setAdapter(addAdapter);
  
          noProject.setVisibility(View.GONE);
          lv.setVisibility(View.VISIBLE);
          listItems.add("New Project");
          ((ArrayAdapter) addAdapter).notifyDataSetChanged();
      }
  
      if (id == R.id.addPeople) {
          return true;
      }
  
  
      return super.onOptionsItemSelected(item);
  }
  </code></pre>