Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;
import android.content.SharedPreferences;

public class Main {
    private static Context context;
    private static final String PRIVATE_CACHE = "PRIVATE_CACHE";

    public static String getString(String key) {
        SharedPreferences preferences = getPrivateSharedPreference();
        return preferences.getString(key, null);
    }

    public static SharedPreferences getPrivateSharedPreference() {
        return context.getSharedPreferences(PRIVATE_CACHE, Context.MODE_PRIVATE);
    }
}