Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.SharedPreferences;

public class Main {
    /**
     * @return {@code Boolean} value if {@code sharedPreferences} contains the value
     *   corresponding to the {@code key}. Otherwise returns {@code null}.
     */
    private static Boolean getBoolean(SharedPreferences sharedPreferences, String key) {
        if (!sharedPreferences.contains(key)) {
            return null;
        }

        // Default value wouldn't be used in actual case, but it is required.
        return Boolean.valueOf(sharedPreferences.getBoolean(key, false));
    }
}