本文整理汇总了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));
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例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));
}
}
示例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;
}
示例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);
}
示例8: doClearRecentSearch
import android.provider.SearchRecentSuggestions; //导入方法依赖的package包/类
private void doClearRecentSearch()
{
SearchRecentSuggestions suggestions = new SearchRecentSuggestions(
getActivity(),
HashtagSuggestionsProvider.AUTHORITY,
HashtagSuggestionsProvider.MODE );
suggestions.clearHistory();
}
示例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();
}
示例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();
}