Note that there are some explanatory texts on larger screens.

plurals
  1. POHow create SearchRecentSuggestionsProvider?
    primarykey
    data
    text
    <p>My code:</p> <p>Provider description: </p> <pre><code> &lt;provider android:name=".searchprovider.MySuggestionProvider" android:authorities="com.example.music.store.searchprovider.MySuggestionProvider" android:exported="false" &gt;&lt;/provider&gt; </code></pre> <p>Java:</p> <pre><code>package com.example.music.store.searchprovider; import android.content.SearchRecentSuggestionsProvider; import android.database.Cursor; import android.database.MergeCursor; import android.net.Uri; import android.util.Log; public class MySuggestionProvider extends SearchRecentSuggestionsProvider { public final static String AUTHORITY = "com.example.music.store.searchprovider.MySuggestionProvider"; public final static int MODE = DATABASE_MODE_2LINES | DATABASE_MODE_QUERIES; public MySuggestionProvider() { super(); setupSuggestions(AUTHORITY, MODE); } @Override public Cursor query(Uri uri, String[] projection, String sel, String[] selArgs, String sortOrder) { Cursor recentCursor = super.query(uri, projection, sel, selArgs, sortOrder); Cursor[] cursors = new Cursor[] { recentCursor, null}; Log.e("CUR", cursors[0].toString()); return new MergeCursor(cursors); //retrieves a custom suggestion cursor and returns it } }</code></pre> <p>But when i run this i don't see my provider. SearchManager searchManager = (SearchManager) (SearchManager)getBaseContext().getApplicationContext().getSystemService(Context.SEARCH_SERVICE); if (searchManager != null) { List searchables = searchManager.getSearchablesInGlobalSearch();</p> <pre><code> SearchableInfo info = searchManager.getSearchableInfo(getComponentName()); for (SearchableInfo inf : searchables) { Log.e("nese",inf.getSuggestAuthority()); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload