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


Java SearchRecentSuggestions.clearHistory方法代碼示例

本文整理匯總了Java中android.provider.SearchRecentSuggestions.clearHistory方法的典型用法代碼示例。如果您正苦於以下問題:Java SearchRecentSuggestions.clearHistory方法的具體用法?Java SearchRecentSuggestions.clearHistory怎麽用?Java SearchRecentSuggestions.clearHistory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.provider.SearchRecentSuggestions的用法示例。


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

示例1: onOptionsItemSelected

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
    switch (menuItem.getItemId()) {
        case R.id.action_clear_history:
            SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this,
                    MySuggestionProvider.AUTHORITY, MySuggestionProvider.MODE);
            suggestions.clearHistory();
            return true;
        case R.id.action_search:
            onSearchRequested();
            return true;
        case R.id.action_about:
            startActivity(new Intent(this, About.class));
            return true;
        case R.id.action_update_yp:
            YellowPagesLoader.getInstance(this).fetchDataAsync();
            return true;
    }
    return (super.onOptionsItemSelected(menuItem));
}
 
開發者ID:LizaAlert-HotLine,項目名稱:AndroidMobileWorkplace,代碼行數:21,代碼來源:MainActivity.java

示例2: onPreferenceTreeClick

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
        Preference preference) {
    final String key = preference.getKey();
    if (KEY_CLEAR_SEARCH_HISTORY.equals(key)) {
        SearchRecentSuggestions suggestions = new SearchRecentSuggestions(
                getActivity(), Utils.getSearchAuthority(getActivity()),
                CalendarRecentSuggestionsProvider.MODE);
        suggestions.clearHistory();
        Toast.makeText(getActivity(), R.string.search_history_cleared,
                Toast.LENGTH_SHORT).show();
        return true;
    } else {
        return super.onPreferenceTreeClick(preferenceScreen, preference);
    }
}
 
開發者ID:x7hub,項目名稱:Calendar_lunar,代碼行數:17,代碼來源:GeneralPreferences.java

示例3: onOptionsItemSelected

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
	switch (item.getItemId())
	{
		case android.R.id.home:
			thread = null;
			finish();
			return true;
		case R.id.action_clear:
			SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, SuggestionProvider.AUTHORITY, SuggestionProvider.MODE);
			suggestions.clearHistory();
			return true;
		default:
			return super.onOptionsItemSelected(item);
	}
}
 
開發者ID:andreynovikov,項目名稱:Androzic,代碼行數:18,代碼來源:SearchableActivity.java

示例4: onClick

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
@Override
protected void onClick() {
    // Data has changed, notify so UI can be refreshed!
	SearchRecentSuggestions suggestions = new SearchRecentSuggestions(getContext(),
	        SearchSuggestions.AUTHORITY, SearchSuggestions.MODE);
	suggestions.clearHistory();
	
	Toast.makeText(getContext(), R.string.onSuggestionsCleared, Toast.LENGTH_SHORT).show();
       notifyChanged();
   }
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:11,代碼來源:ClearSearchSuggestions.java

示例5: onOptionsItemSelected

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
@Override
public void onOptionsItemSelected(MenuItem item) {

    if (item.getItemId() == R.id.action_delete) {

        SearchRecentSuggestions recentSuggestions = new SearchRecentSuggestions(getContext(),
                SearchableProvider.AUTHORITY,
                SearchableProvider.MODE);

        recentSuggestions.clearHistory();

        view.showToast(getContext().getString(R.string.search_history_deleted));
    }
}
 
開發者ID:pedromassango,項目名稱:Programmers,代碼行數:15,代碼來源:Presenter.java

示例6: onOptionsItemSelected

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
@Override
 public boolean onOptionsItemSelected(MenuItem item) {
     switch (item.getItemId()) {
case R.id.search:
	this.onSearchRequested();
	break;
case R.id.clear_search_sug:
	SearchRecentSuggestions suggestions = new SearchRecentSuggestions(context, SearchSuggestions.AUTHORITY, SearchSuggestions.MODE);
	suggestions.clearHistory();
	Toast.makeText(context, R.string.clear_search_sug_ok, Toast.LENGTH_LONG).show();
	break;
         case R.id.save:
             try {
                 PrintWriter printWriter = new PrintWriter(fileAbsolutePath);
                 printWriter.print(text.getText());
                 printWriter.close();
                 Toast.makeText(context,getString(R.string.saved_ok), Toast.LENGTH_SHORT).show();
		if (isTextChanged())
		{
			actionbar.setTitle(title);
		}
                 break;
             } catch(Exception e){
		//Log.e(TAG,"canot read file");
		break;
	}
         case R.id.close:
             finish();
             break;
     }
     return true;
 }
 
開發者ID:aToxyD,項目名稱:android_boot_image_manager_apk,代碼行數:33,代碼來源:TextEditor.java

示例7: onOptionsItemSelected

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    switch (id) {
        case R.id.action_settings_logged_in:
            startActivity(new Intent(this, LoginActivity.class));
            return true;
        case R.id.action_settings_logged_out:
            custom_signout();
            break;

        case R.id.clearSuggestion:
            SearchRecentSuggestions searchRecentSuggestions = new SearchRecentSuggestions(this, SearchableProvider.AUTHORITY,SearchableProvider.MODE);
            searchRecentSuggestions.clearHistory();
            break;
        case R.id.action_settings_open_userProfile:
            startActivity(new Intent(this, UserProfileOwner.class));
            break;

        case R.id.action_settings_main:
            startActivity(new Intent(this, SettingsActivity.class));
            break;

    }

    return super.onOptionsItemSelected(item);
}
 
開發者ID:asifali22,項目名稱:Focus-Android-App,代碼行數:29,代碼來源:FirstActivity.java

示例8: doClearRecentSearch

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
private void doClearRecentSearch()
{
    SearchRecentSuggestions suggestions = new SearchRecentSuggestions(
            getActivity(),
            HashtagSuggestionsProvider.AUTHORITY,
            HashtagSuggestionsProvider.MODE );
    suggestions.clearHistory();
}
 
開發者ID:iTwenty,項目名稱:Hashtagger,代碼行數:9,代碼來源:SettingsFragment.java

示例9: clearSearchRecents

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
/**
 * Clear the recents' history.
 */
public static void clearSearchRecents(Context c) {
	SearchRecentSuggestions suggestions = new SearchRecentSuggestions(c,
			RecentsSuggestionsProvider.AUTHORITY,
			RecentsSuggestionsProvider.MODE);
	suggestions.clearHistory();
}
 
開發者ID:msafin,項目名稱:wmc,代碼行數:10,代碼來源:SearchableActivity.java

示例10: clearSearchHistory

import android.provider.SearchRecentSuggestions; //導入方法依賴的package包/類
/**
 * Any application that implements search suggestions based on previous actions (such as
 * recent queries, page/items viewed, etc.) should provide a way for the user to clear the
 * history.  This gives the user a measure of privacy, if they do not wish for their recent
 * searches to be replayed by other users of the device (via suggestions).
 * 
 * This example shows how to clear the search history for apps that use 
 * android.provider.SearchRecentSuggestions.  If you have developed a custom suggestions
 * provider, you'll need to provide a similar API for clearing history.
 * 
 * In this sample app we call this method from a "Clear History" menu item.  You could also 
 * implement the UI in your preferences, or any other logical place in your UI.
 */
private void clearSearchHistory() {
    SearchRecentSuggestions suggestions = new SearchRecentSuggestions(this, 
            SearchSuggestionSampleProvider.AUTHORITY, SearchSuggestionSampleProvider.MODE);
    suggestions.clearHistory();
}
 
開發者ID:luoqii,項目名稱:ApkLauncher,代碼行數:19,代碼來源:SearchInvoke.java


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