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 {
    private static SharedPreferences mPreferences;
    private static final String CONFIG_NAME = "config";

    public static void saveIntegerConfig(Context context, String key, int value) {
        loadSharedPreferences(context);
        mPreferences.edit().putInt(key, value).commit();
    }

    private static void loadSharedPreferences(Context context) {
        mPreferences = context.getSharedPreferences(CONFIG_NAME, Context.MODE_PRIVATE);
    }
}