Code example for UriMatcher

Methods: addURI

0
 
    /** 
     * Builds up a UriMatcher for search suggestion and shortcut refresh queries. 
     */ 
    private static UriMatcher buildUriMatcher() {
        UriMatcher matcher =  new UriMatcher(UriMatcher.NO_MATCH);
        // to get definitions... 
        matcher.addURI(AUTHORITY, "dictionary", SEARCH_WORDS);
        matcher.addURI(AUTHORITY, "dictionary/#", GET_WORD);
        // to get suggestions... 
        matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY, SEARCH_SUGGEST);
        matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_QUERY + "/*", SEARCH_SUGGEST);
 
        /* The following are unused in this implementation, but if we include 
         * {@link SearchManager#SUGGEST_COLUMN_SHORTCUT_ID} as a column in our suggestions table, we 
         * could expect to receive refresh queries when a shortcutted suggestion is displayed in 
         * Quick Search Box, in which case, the following Uris would be provided and we 
         * would return a cursor with a single item representing the refreshed suggestion data. 
         */ 
        matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT, REFRESH_SHORTCUT);
        matcher.addURI(AUTHORITY, SearchManager.SUGGEST_URI_PATH_SHORTCUT + "/*", REFRESH_SHORTCUT);
        return matcher;
    } 
 
    @Override 
    public boolean onCreate() {