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 {
    public static final String RECOMMEND_RIGHT = "recommend_right";
    public static final String RECOMMEND_FIRST = "recommend_first";

    public static void setRecommendRightFlag(Context context, boolean flag) {
        if (context != null) {
            SharedPreferences settings = context.getSharedPreferences(RECOMMEND_RIGHT, 0);
            SharedPreferences.Editor editor = settings.edit();
            editor.putBoolean(RECOMMEND_FIRST, flag);
            editor.commit();
        }
    }
}