Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    private static final String PREFERENCES_AUTHORIZED_KEY = "isAuthorized";
    private static final String LOGIN_PREFERENCES = "LoginData";

    /**
     * This method makes the user authorized
     *
     * @param context current context
     */

    public static void setAuthorized(Context context) {
        context.getSharedPreferences(LOGIN_PREFERENCES, Context.MODE_PRIVATE).edit()
                .putBoolean(PREFERENCES_AUTHORIZED_KEY, true).apply();
    }
}