Method to clear Preference in SharedPreferences - Android Android OS

Android examples for Android OS:SharedPreferences

Description

Method to clear Preference in SharedPreferences

Demo Code


//package com.java2s;

import android.content.Context;
import android.content.SharedPreferences;

public class Main {
    /**/*from  w  w  w  . j av a2  s.c  o  m*/
     * Method clearPreference ...
     *
     * @param paramContext of type Context
     */
    public static void clearPreference(Context paramContext) {
        SharedPreferences.Editor localEditor = paramContext
                .getSharedPreferences("com.java2s", 0).edit();
        localEditor.clear();
        localEditor.commit();
    }
}

Related Tutorials