當前位置: 首頁>>代碼示例>>Java>>正文


Java SearchRecentSuggestionsProvider類代碼示例

本文整理匯總了Java中android.content.SearchRecentSuggestionsProvider的典型用法代碼示例。如果您正苦於以下問題:Java SearchRecentSuggestionsProvider類的具體用法?Java SearchRecentSuggestionsProvider怎麽用?Java SearchRecentSuggestionsProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SearchRecentSuggestionsProvider類屬於android.content包,在下文中一共展示了SearchRecentSuggestionsProvider類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: sendSearchIntent

import android.content.SearchRecentSuggestionsProvider; //導入依賴的package包/類
private void sendSearchIntent () {
    try {
        Intent sendIntent = new Intent(this, Class.forName(searchableActivity));
        sendIntent.setAction(Intent.ACTION_SEARCH);
        sendIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        sendIntent.putExtra(SearchManager.QUERY, query);

        // If it is set one-line mode, directly saves the suggestion in the provider
        if (!CustomSearchableInfo.getIsTwoLineExhibition()) {
            SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, providerAuthority, SearchRecentSuggestionsProvider.DATABASE_MODE_QUERIES);
            suggestions.saveRecentQuery(query, null);
        }

        startActivity(sendIntent);
        finish();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}
 
開發者ID:edsilfer,項目名稱:custom-searchable,代碼行數:20,代碼來源:SearchActivity.java

示例2: getManifestConfig

import android.content.SearchRecentSuggestionsProvider; //導入依賴的package包/類
private void getManifestConfig () {
    try {
        Map<String, String> providers = ManifestParser.getProviderNameAndAuthority(this);

        OUTER: for (String key : providers.keySet()) {
            providerAuthority = providers.get(key).toString();
            providerName = key;

            if (Class.forName(providerName).getSuperclass().equals(SearchRecentSuggestionsProvider.class)) {
                isRecentSuggestionsProvider = Boolean.TRUE;

                break OUTER;
            } else {
                isRecentSuggestionsProvider = Boolean.FALSE;
            }
        }

        searchableActivity = ManifestParser.getSearchableActivity(this);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}
 
開發者ID:edsilfer,項目名稱:custom-searchable,代碼行數:23,代碼來源:SearchActivity.java

示例3: requestSearch

import android.content.SearchRecentSuggestionsProvider; //導入依賴的package包/類
/**
 * Tests if search query is valid and internet connection is available.
 * Then starts a new search.
 *
 * @param query Query to search for
 */
protected void requestSearch(String query) {
    mQuery = query;
    if (query.length() < mMinLength) {
        final String text = String.format(getString(R.string.min_search_len), mMinLength);
        Utils.showToast(this, text);
        return;
    }

    /*if (!Utils.isConnected(this)) {
        showNoInternetLayout();
        return;
    }*/

    // Add query to recents
    SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, mAuthority, SearchRecentSuggestionsProvider.DATABASE_MODE_QUERIES);
    suggestions.saveRecentQuery(query, null);

    // Tell activity to start searching
    onStartSearch(query);
}
 
開發者ID:TCA-Team,項目名稱:TumCampusApp,代碼行數:27,代碼來源:ActivityForSearching.java


注:本文中的android.content.SearchRecentSuggestionsProvider類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。