Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

public class Main {
    public static final String DEF_PREF_NAME = "Default";

    public static void removeValue(Context context, String name) {
        SharedPreferences pref = getPref(context, DEF_PREF_NAME);
        Editor editor = pref.edit();
        editor.remove(name);
        editor.commit();
    }

    public static SharedPreferences getPref(Context context, String name) {
        return context.getSharedPreferences(name, Context.MODE_PRIVATE);
    }
}