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 final String PREFERENCE_NAME = "user_center";

    public static boolean getPreferenceBoolean(Context context, String key, boolean defValue) {
        SharedPreferences prefs = context.getSharedPreferences(PREFERENCE_NAME, Context.MODE_PRIVATE);
        boolean value = prefs.getBoolean(key, defValue);
        return value;
    }

    public static boolean getPreferenceBoolean(String preference, Context context, String key, boolean defValue) {
        SharedPreferences prefs = context.getSharedPreferences(preference, Context.MODE_PRIVATE);
        boolean value = prefs.getBoolean(key, defValue);
        return value;
    }
}