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;
import java.util.HashSet;
import java.util.Set;

public class Main {
    public static final String DEFAULT_FILE_NAME = "playTogetherAttr";

    public static Set<String> getStringSetProperty(Context context, String key) {
        SharedPreferences sp = context.getSharedPreferences(DEFAULT_FILE_NAME, Context.MODE_PRIVATE);
        return sp.getStringSet(key, null);
    }

    public static Set<String> getStringSetProperty(Context context, String key, String fileName) {
        SharedPreferences sp = context.getSharedPreferences(fileName, Context.MODE_PRIVATE);
        return sp.getStringSet(key, new HashSet<String>());
    }
}