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;

public class Main {
    public final static String XML_Settings = "settings";
    private static SharedPreferences settings;

    public static void clearSave(Context context) {
        settings = context.getSharedPreferences(XML_Settings, 0);
        for (String name : settings.getAll().keySet()) {
            saveSharedPreString(context, name, "");
        }
    }

    public static void saveSharedPreString(Context context, String key, String value) {
        settings = context.getSharedPreferences(XML_Settings, Context.MODE_PRIVATE);
        settings.edit().putString(key, value).commit();
    }
}