title: Takes 2 clicks of Enter to get a response into the recyclerview
body: <p>I am making an app for one of my classes, a project that we got to choose for ourselves. Right now it's mostly working except for a few things here and there. One of those things is that it takes 2 or 3 clicks of enter to get the app to redo the recyclerview with the updated information. </p>
  
  <pre><code>public View.OnKeyListener search = new View.OnKeyListener()
  {
      @Override
      public boolean onKey(View v, int keyCode, KeyEvent event)
      {
          searchItem = "";//clears it out before the use of it
  
          if((event.getAction() == KeyEvent.ACTION_DOWN) &amp;&amp; (keyCode == KeyEvent.KEYCODE_ENTER))//only executes when the ENTER key is hit
          {
              if(searchItem != searchBar.getText().toString())//as long as the bar isn't empty
              {
                  searchItem = searchBar.getText().toString();//grabs the search term and puts it in the variable
  
              }
  
              // hide the virtual keyboard
              ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(v.getWindowToken(), 0);
  
              //clear out the recyclerview
              clearRecycler();
  
              //API Call one
              goGetSearch(searchItem, searchType);
              return true;
          }
          return false;
      }
  };
  </code></pre>
  
  <p>Here is the clearRecycler method that I call. I removed items using for loops because the .clear wasn't working correctly for me for some reason.</p>
  
  <pre><code>public void clearRecycler()
      {
          int size = details.size();
          if (size &gt; 0)
          {
              for(int i = 0; i &lt; size; i++)
              {
                  details.remove(0);//arraylist
              }
              for(int i = 0; i &lt; OnlyIds.size(); i++)
              {
                  OnlyIds.remove(0);//arraylist
              }
              myAdapter.notifyItemRangeRemoved(0, size);
          }
      }
  </code></pre>
  
  <p>If there is any other code that you would need to help me fix this problem let me know, I think everything should be here.</p>