本文整理汇总了Java中android.content.SharedPreferences.Editor.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Editor.remove方法的具体用法?Java Editor.remove怎么用?Java Editor.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.SharedPreferences.Editor
的用法示例。
在下文中一共展示了Editor.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: record
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
/**
* Record the precache event. The event is persisted in shared preferences if the native library
* is not loaded. If library is loaded, the event will be recorded as UMA metric, and any prior
* persisted events are recorded to UMA as well.
* @param event the precache event.
*/
public static void record(int event) {
SharedPreferences sharedPreferences = ContextUtils.getAppSharedPreferences();
long persistent_metric = sharedPreferences.getLong(PREF_PERSISTENCE_METRICS, 0);
Editor preferencesEditor = sharedPreferences.edit();
if (LibraryLoader.isInitialized()) {
RecordHistogram.recordEnumeratedHistogram(
EVENTS_HISTOGRAM, Event.getBitPosition(event), Event.EVENT_END);
for (int e : Event.getEventsFromBitMask(persistent_metric)) {
RecordHistogram.recordEnumeratedHistogram(
EVENTS_HISTOGRAM, Event.getBitPosition(e), Event.EVENT_END);
}
preferencesEditor.remove(PREF_PERSISTENCE_METRICS);
} else {
// Save the metric in preferences.
persistent_metric = Event.addEventToBitMask(persistent_metric, event);
preferencesEditor.putLong(PREF_PERSISTENCE_METRICS, persistent_metric);
}
preferencesEditor.apply();
}
示例2: clearExpired
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public boolean clearExpired(Date date) {
boolean clearedAny = false;
Editor prefsWriter = this.cookiePrefs.edit();
for (Entry<String, Cookie> entry : this.cookies.entrySet()) {
String name = (String) entry.getKey();
if (((Cookie) entry.getValue()).isExpired(date)) {
this.cookies.remove(name);
prefsWriter.remove(COOKIE_NAME_PREFIX + name);
clearedAny = true;
}
}
if (clearedAny) {
prefsWriter.putString(COOKIE_NAME_STORE, TextUtils.join(",", this.cookies.keySet()));
}
prefsWriter.commit();
return clearedAny;
}
示例3: clear
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public void clear() {
Editor prefsWriter = this.cookiePrefs.edit();
for (String name : this.cookies.keySet()) {
prefsWriter.remove(COOKIE_NAME_PREFIX + name);
}
prefsWriter.remove(COOKIE_NAME_STORE);
prefsWriter.commit();
this.cookies.clear();
}
示例4: remove
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public void remove( String... keys) {
if (context != null && keys != null && keys.length > 0) {
Editor editor = context.getSharedPreferences(USER_CONFING, Context.MODE_PRIVATE).edit();
for (String keyItem : keys) {
editor.remove(keyItem);
}
editor.apply();
}
}
示例5: removeTokenExpiresIn
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void removeTokenExpiresIn(Context context, SHARE_MEDIA share_media) {
if (context == null) {
Log.w(TAG, "context is null when removing expires in");
return;
}
Object keywordByPlatform = SocialSNSHelper.getKeywordByPlatform(share_media);
if (TextUtils.isEmpty(keywordByPlatform)) {
Log.w(TAG, "platform is null when save expires in ");
return;
}
Editor edit = context.getSharedPreferences(SocializeConstants
.SOCIAL_PREFERENCE_EXPIRE_IN, 0).edit();
edit.remove(keywordByPlatform);
edit.commit();
}
示例6: logoutFromTwitter
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public void logoutFromTwitter() {
stopListeningOnAKeyword();
Editor e = mSharedPreferences.edit();
e.remove(PREF_KEY_OAUTH_TOKEN);
e.remove(PREF_KEY_OAUTH_SECRET);
e.remove(PREF_KEY_TWITTER_LOGIN);
e.remove(PREF_KEY_TWITTER_USERNAME);
e.commit();
}
示例7: wipePreferences
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void wipePreferences(SharedPreferences pref, boolean userChanged) {
Editor editor = pref.edit();
if (!userChanged) {
editor.remove(Trakt.KEY_TRAKT_USER);
editor.remove(Trakt.KEY_TRAKT_SHA1);
editor.remove(Trakt.KEY_TRAKT_LIVE_SCROBBLING);
editor.remove(Trakt.KEY_TRAKT_SYNC_COLLECTION);
}
editor.remove(Trakt.KEY_TRAKT_SYNC_FLAG);
editor.remove(Trakt.KEY_TRAKT_LAST_TIME_MOVIE_WATCHED);
editor.remove(Trakt.KEY_TRAKT_LAST_TIME_SHOW_WATCHED);
editor.commit();
}
示例8: a
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
private void a(SharedPreferences sharedPreferences) {
Editor edit = sharedPreferences.edit();
edit.remove(a);
edit.remove(b);
edit.remove("a_start_time");
edit.remove("a_end_time");
edit.putString(f, "");
edit.commit();
}
示例9: setAccessToken
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void setAccessToken(SharedPreferences pref, String accessToken) {
Editor editor = pref.edit();
if (accessToken != null) {
editor.putString(KEY_TRAKT_ACCESS_TOKEN, accessToken);
} else {
editor.remove(KEY_TRAKT_ACCESS_TOKEN);
}
editor.commit();
}
示例10: clear
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public void clear() {
this.cookies.clear();
Editor prefsWriter = this.cookiePrefs.edit();
for (String name : this.cookies.keySet()) {
prefsWriter.remove(new StringBuilder(COOKIE_NAME_PREFIX).append(name).toString());
}
prefsWriter.remove(COOKIE_NAME_STORE);
prefsWriter.commit();
}
示例11: rmLoginInfo
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static synchronized void rmLoginInfo(Context context) {
synchronized (LoginInfoHelp.class) {
Editor edit = context.getSharedPreferences(SocializeConstants.SOCIAL_PREFERENCE_NAME,
0).edit();
edit.remove(SOCIALIZE_IDENTITY_INFO_KEY);
edit.commit();
}
}
示例12: deleteRefreshToken
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static void deleteRefreshToken(Context context, SHARE_MEDIA share_media) {
Editor edit = context.getSharedPreferences(SocializeConstants
.SOCIAL_PREFERENCE_REFRESH_TOKEN, 0).edit();
edit.remove(share_media.toString());
edit.commit();
edit = context.getSharedPreferences(SocializeConstants
.SOCIAL_PREFERENCE_REFRESH_TOKEN_EXPIRES, 0).edit();
edit.remove(share_media.toString());
edit.commit();
}
示例13: remove
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public void remove(String key) {
Editor edit = sharedPreferences.edit();
edit.remove(key);
edit.apply();
}
示例14: remove
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static boolean remove(String key)
{
Editor editor = edit();
editor.remove(key);
return editor.commit();
}
示例15: removeTemp
import android.content.SharedPreferences.Editor; //导入方法依赖的package包/类
public static boolean removeTemp(String key)
{
Editor editor = editTemp();
editor.remove(key);
return editor.commit();
}