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 = "com.titanzhang.AutoBT";
    private static final String PREF_ENABLE_SERVICE = "EnableService";
    private static final int PREF_MODE = Context.MODE_WORLD_WRITEABLE;

    public static void savePreference(Context context, boolean bEnableService) {
        SharedPreferences pref = context.getApplicationContext().getSharedPreferences(PREFERENCE_NAME, PREF_MODE);
        SharedPreferences.Editor editor = pref.edit();
        editor.putBoolean(PREF_ENABLE_SERVICE, bEnableService);
        editor.commit();

    }
}