当前位置: 首页>>代码示例>>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;未经允许,请勿转载。