title: Can't display my custom suggestion using SearchView
body: <p>I'm using a SearchView and I have added the search feature (that works) and now I'm trying to add a custom suggestion. The provider is created but when i type something query() is never called for some reasons.</p>
  
  <p>Where am I wrong?</p>
  
  <p>Here my manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.chefme.chefme"&gt;
  
      &lt;uses-feature
          android:name="android.hardware.sensor.accelerometer"
          android:required="true" /&gt;
  
      &lt;uses-feature
          android:name="android.permission-group.MICROPHONE"
          android:required="true"/&gt;
  
      &lt;uses-feature android:name="android.hardware.camera"
          android:required="true" /&gt;
  
  &lt;!--    &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
          android:maxSdkVersion="18" /&gt;--&gt;
  
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
  
          &lt;provider
              android:name=".RecipeIngredientTabs.SuggestionProvider"
              android:authorities="com.chefme.chefme.RecipeIngredientTabs.SuggestionProvider"&gt;
          &lt;/provider&gt;
  
          &lt;activity
              android:name=".Startup"
              android:theme="@style/AppTheme.NoActionBar"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".RecipeIngredientTabs.Main"
              android:label="@string/app_name"
              android:launchMode="singleTop"
              android:theme="@style/AppTheme.NoActionBar" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.SEARCH" /&gt;
              &lt;/intent-filter&gt;
              &lt;meta-data android:name="android.app.searchable"
                  android:resource="@xml/searchable"/&gt;
          &lt;/activity&gt;
  
          &lt;activity
              android:name=".RecipeStep"
              android:label="@string/title_activity_recipe_steps"
              android:launchMode="singleInstance"
              android:theme="@style/AppTheme.NoActionBar" /&gt;
          &lt;activity
              android:name=".RecipePreview.RecipePreview"
              android:label="@string/title_activity_recipe_preview"
              android:launchMode="singleInstance"
              android:theme="@style/AppTheme.NoActionBar" /&gt;
          &lt;activity
              android:name=".ShoppingList.ShoppingList"
              android:label="@string/title_activity_shopping_list"
              android:launchMode="singleInstance"
              android:theme="@style/AppTheme.NoActionBar" /&gt;
          &lt;activity
              android:name=".Settings.Diets"
              android:label="@string/title_activity_diets"
              android:launchMode="singleInstance"
              android:theme="@style/AppTheme.NoActionBar"/&gt;
          &lt;activity
              android:name=".Favorite.FavoriteActivity"
              android:label="@string/title_activity_favorite"
              android:launchMode="singleInstance"
              android:theme="@style/AppTheme.NoActionBar"/&gt;
          &lt;activity
              android:name=".ownRecipesCamera.TakePicture"
              android:label="@string/title_activity_take_picture"
              android:launchMode="singleInstance"
              android:theme="@style/AppTheme.NoActionBar"/&gt;
          &lt;activity
              android:name=".Settings.Credits"
              android:label="@string/title_activity_credits"
              android:launchMode="singleInstance"
              android:theme="@style/AppTheme.NoActionBar"/&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Here my Provider:</p>
  
  <pre><code>package com.chefme.chefme.RecipeIngredientTabs;
  
  import android.content.ContentProvider;
  import android.content.ContentValues;
  import android.database.Cursor;
  import android.database.MatrixCursor;
  import android.net.Uri;
  import android.support.annotation.Nullable;
  
  import DBUtility.Data;
  
  
  public class SuggestionProvider extends ContentProvider{
      @Override
      public boolean onCreate() {
          System.out.println("Creation Provider");
          return true;
      }
  @Nullable
  @Override
  public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
      String query = uri.getLastPathSegment().toLowerCase();  //Dovrebbe essere chiamato tramite searchable.xml
      System.out.println("write: "+ query);
  
      String[] columns = new String[]{"_ID", "SUGGEST_COLUMN_TEXT_1", "SUGGEST_COLUMN_ICON_1", "SUGGEST_COLUMN_INTENT_DATA"};
      MatrixCursor cursor = new MatrixCursor(columns);
  
      Object[] row = new Object[]{0, Data.currentIngredients.get(0).getName(), Data.currentIngredients.get(0).getImage(), "Gigi"};
      cursor.addRow(row);
  
      return cursor;
  }
  
  @Nullable
  @Override
  public String getType(Uri uri) {
      return null;
  }
  
  @Nullable
  @Override
  public Uri insert(Uri uri, ContentValues contentValues) {
      return null;
  }
  
  @Override
  public int delete(Uri uri, String s, String[] strings) {
      return 0;
  }
  
  @Override
  public int update(Uri uri, ContentValues contentValues, String s, String[] strings) {
      return 0;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Here my searchable.xml:</p>
  
  <pre><code>  &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;searchable xmlns:android="http://schemas.android.com/apk/res/android"
      android:label="@string/app_name"
      android:hint="@string/action_search" &gt;
      android:searchSuggestAuthority="com.chefme.chefme.RecipeIngredientTabs.SuggestionProvider
      android:searchSuggestIntentAction="android.Intent.action.VIEW" &gt;
  &lt;/searchable&gt;
  </code></pre>
  
  <p>Here my main:</p>
  
  <pre><code>package com.chefme.chefme.RecipeIngredientTabs;
  
  import android.Manifest;
  import android.app.Activity;
  import android.app.SearchManager;
  import android.content.Context;
  import android.content.Intent;
  import android.content.pm.PackageManager;
  import android.os.Bundle;
  import android.os.Environment;
  import android.support.design.widget.TabLayout;
  import android.support.v4.app.ActivityCompat;
  import android.support.v4.app.Fragment;
  import android.support.v4.app.FragmentManager;
  import android.support.v4.app.FragmentPagerAdapter;
  import android.support.v4.view.ViewPager;
  import android.support.design.widget.NavigationView;
  import android.support.v4.widget.DrawerLayout;
  import android.support.v7.app.ActionBarDrawerToggle;
  import android.support.v7.widget.SearchView;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.Toast;
  
  import com.chefme.chefme.NavbarActivity;
  import com.chefme.chefme.R;
  
  import java.io.File;
  
  import DBUtility.Data;
  
  public class Main extends NavbarActivity {
  
      private SectionsPagerAdapter selectorPagerAdapter;
      private ViewPager mViewPager;
      private TabLayout tabLayout;
      private Toast backtoast;
  
      // Storage Permissions
      private static final int REQUEST_EXTERNAL_STORAGE = 1;
      private static String[] PERMISSIONS_STORAGE = {
              Manifest.permission.READ_EXTERNAL_STORAGE,
              Manifest.permission.WRITE_EXTERNAL_STORAGE
      };
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          super.replaceContentLayout(R.layout.main_content, super.CONTENT_LAYOUT_ID);
  
          verifyDirectoryExists();
  
          verifyStoragePermissions(this);
  
          handleIntent(getIntent());
  
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
          ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
                  this, //host activity
                  drawer, //drawerLayout object
                  toolbar, //nav drawer icon to replace
                  R.string.navigation_drawer_open,
                  R.string.navigation_drawer_close);
          drawer.setDrawerListener(toggle);
          toggle.syncState();
  
          NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
          navigationView.setNavigationItemSelectedListener(this);
  
          // Create the adapter that will return a fragment for each of the three
          // primary sections of the activity.
          selectorPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
  
          // Set up the ViewPager with the sections adapter.
          mViewPager = (ViewPager) findViewById(R.id.container);
          mViewPager.setAdapter(selectorPagerAdapter);
  
          tabLayout = (TabLayout) findViewById(R.id.tabs);
          tabLayout.setupWithViewPager(mViewPager);
      }
  
      @Override
      protected void onResume(){
          super.onResume();
          Data.active_main = true;
      }
  
      @Override
      protected void onPause(){
          super.onPause();
          Data.active_main = false;
      }
  
      public void onBackPressed() {
              if(backtoast!=null&amp;&amp;backtoast.getView().getWindowToken()!=null) {
                  finish();
              } else {
                  backtoast = Toast.makeText(this, "Press back to exit", Toast.LENGTH_SHORT);
                  backtoast.show();
              }
      }
  
      @Override
      protected void onNewIntent(Intent intent) {
          setIntent(intent);
          handleIntent(intent);
      }
  
      private void handleIntent(Intent intent) {
          if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
              String query = intent.getStringExtra(SearchManager.QUERY);
              System.out.println("Searched: " + query);
          }
          else if (Intent.ACTION_VIEW.equals(intent.getAction())) { //Intent partito da SuggestionProvider
              String query = intent.getDataString();
              System.out.println("Suggested: " + query);
          }
  
      }
  
      //------------------------------------------------------------------------------------------
      //                              TAB SELECTOR FUNCTIONS
      //------------------------------------------------------------------------------------------
  
      public class SectionsPagerAdapter extends FragmentPagerAdapter {
  
          public SectionsPagerAdapter(FragmentManager fm) {
              super(fm);
          }
  
          @Override
          public Fragment getItem(int position) {
              // getItem is called to instantiate the fragment for the given page.
              if(position == 0)
                  return new TabFragmentIngredients();
              if(position == 1)
                  return new TabFragmentRecipes();
              else
                  return null;
          }
  
          @Override
          public int getCount() {
              // Show 2 total pages.
              return 2;
          }
  
  
          @Override
          public CharSequence getPageTitle(int position) {
              switch (position) {
                  case 0:
                      return getString(R.string.name_ingredients_hint);
                  case 1:
                      return getString(R.string.name_recipes_hint);
              }
              return null;
          }
      }
  
  
      //------------------------------------------------------------------------------------------
      //                                     MENU FUNCTIONS
      //------------------------------------------------------------------------------------------
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.main, menu);
  
          // Get the SearchView and set the searchable configuration
          SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
          SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
          // Assumes current activity is the searchable activity
          searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
          searchView.setIconifiedByDefault(false); // Do not iconify the widget; expand it by default
  
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
  
          switch (item.getItemId()) {
              case R.id.action_settings: showOrderbyDialog();
                  return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      private void showOrderbyDialog() {
          FragmentManager fm = getSupportFragmentManager();
          OrderByDialog orderbyDialogDialog = new OrderByDialog();
          orderbyDialogDialog.show(fm, "");
      }
  
      public static void verifyDirectoryExists(){
  
          String folder_main = "GnammyRecipes";
  
          File f = new File(Environment.getExternalStorageDirectory()+"/Pictures/", folder_main);
  
          if (!f.exists()) {
              f.mkdirs();
          }
      }
  
  
      public static void verifyStoragePermissions(Activity activity) {
          // Check if we have write permission
          int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
  
          if (permission != PackageManager.PERMISSION_GRANTED) {
              // We don't have permission so prompt the user
              ActivityCompat.requestPermissions(
                      activity,
                      PERMISSIONS_STORAGE,
                      REQUEST_EXTERNAL_STORAGE
              );
          }
      }
  
  
  
  }
  </code></pre>