Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

public class Main {

    private static final String PREF_FILE = "RADIX_PERSISTANT";

    public static String getString(String prefFile, Context context, String key) {
        return getString(prefFile, context, key, "");
    }

    public static String getString(Context context, String key) {
        return getString(PREF_FILE, context, key, "");
    }

    /**
     * @param context
     * @param key
     * @param defValue
     * @return
     */
    public static String getString(Context context, String key, String defValue) {
        return getString(PREF_FILE, context, key, defValue);
    }

    public static String getString(String prefFile, Context context, String key, String defValue) {
        SharedPreferences settings = context.getSharedPreferences(prefFile, Context.MODE_PRIVATE);
        return settings.getString(key, defValue);
    }
}