title: Create "history" to SearchView on ActionBar
body: <p>I want to have history on my SearchView, I've been googling around, and the only sensible(?) tutorial I found was <a href="http://developer.android.com/guide/topics/search/adding-recent-query-suggestions.html" rel="nofollow noreferrer">this</a>, but that's just for like Gingerbread, not API>14.</p>
  
  <p>Then I found this code: </p>
  
  <pre><code>String[] columnNames = {"_id","text"};
          MatrixCursor cursor = new MatrixCursor(columnNames);
          String[] array = {"Snääälla", "bla bla bla", "Jävla piss"}; //if strings are in resources
          String[] temp = new String[2];
          int id = 0;
          for(String item : array){
              temp[0] = Integer.toString(id++);
              temp[1] = item;
              cursor.addRow(temp);
          }
          String[] from = {"text"};
          int[] to = {android.R.id.text1};
          CursorAdapter ad = new SimpleCursorAdapter(this.getActivity(), android.R.layout.simple_list_item_1, cursor, from, to);
          mSearchView.setSuggestionsAdapter(ad);
  </code></pre>
  
  <p>And that code only works half, since it doesn't show results from what you've already written, it shows all the items.</p>
  
  <p>I just want it to look like this: </p>
  
  <p><img src="https://i.stack.imgur.com/Pw7pFl.png" alt="Google Play Store screnshot"></p>
  
  <p>This is my current code for adding the SearchView: </p>
  
  <p>res/menu/menu.xml:</p>
  
  <pre><code>&lt;item android:id="@+id/fragment_searchmenuitem"
        android:icon="@drawable/ic_search_white"
        android:title="@string/menu_search"
        android:showAsAction="collapseActionView|ifRoom"
        android:actionViewClass="android.widget.SearchView" /&gt;
  </code></pre>
  
  <p>MainActivity.java:</p>
  
  <pre><code>@Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      if(!mDrawerLayout.isDrawerOpen(mDrawerList)) {
          inflater.inflate(R.menu.fragment_search, menu);
  
          mMenuItem = menu.findItem(R.id.fragment_searchmenuitem);
          mSearchView = (SearchView) mMenuItem.getActionView();
          mMenuItem.expandActionView();
          mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
              @Override
              public boolean onQueryTextSubmit(String s) {
                  mMenuItem.collapseActionView();
                  searchSupport.SearchForLyrics(s);
                  actionBar.setSubtitle("Searcing for: " + s);
                  return true;
              }
  
              @Override
              public boolean onQueryTextChange(String s) {
                  return false;
              }
          });
      }
  
      super.onCreateOptionsMenu(menu, inflater);
  }
  </code></pre>
  
  <p>Could someone please just give me something to start with, to be honest I have no idea where to start. So any help would be really appreciated.</p>