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 SHERED_NAME = "mySharedName";
    private static final String SHARED_KEY_IS_LOGGED = "isLogged";

    public static void saveLogin(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences(SHERED_NAME, Context.MODE_PRIVATE);
        sharedPreferences.edit().putBoolean(SHARED_KEY_IS_LOGGED, true).commit();

    }
}