本文整理匯總了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();
}