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 {
    /**
     * @param context Context of Host application
     * @param prefFileName Preference file name
     * @param attributeName Attribute name
     * @param defaultValue Default value of attribute
     * @return boolean Value
     */
    public static boolean getFromSharedPreference(Context context, String prefFileName, String attributeName,
            boolean defaultValue) {
        SharedPreferences myPref = context.getSharedPreferences(prefFileName, Context.MODE_PRIVATE);
        return myPref.getBoolean(attributeName, defaultValue);
    }
}