Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class Main {
    @SuppressLint("CommitPrefEdits")
    public static void defaultState(Context context, boolean state) {
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
        if (!prefs.contains("wifi_state"))
            prefs.edit().putBoolean("wifi_state", state).commit();
    }
}