clear SharedPreferences - Android Android OS

Android examples for Android OS:SharedPreferences

Description

clear SharedPreferences

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class Main {
    public static boolean clear(Context context) {
        return getPrefs(context).edit().clear().commit();
    }/*from  www .j  av a 2 s  . co m*/

    private static SharedPreferences getPrefs(Context context) {
        return PreferenceManager.getDefaultSharedPreferences(context);
    }
}

Related Tutorials