Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

public class Main {
    private static SharedPreferences sp;

    public static int getInt(Context context, String key) {
        if (sp == null) {
            sp = context.getSharedPreferences(context.getPackageName(), Activity.MODE_PRIVATE);
        }
        return sp.getInt(key, 0);
    }
}