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

import android.content.SharedPreferences;

public class Main {
    public static boolean saveSet(SharedPreferences prefs, Set<String> set, String setName) {
        SharedPreferences.Editor editor = prefs.edit();
        final int setSize = set.size();
        editor.putInt(setName + "_size", setSize);
        int i = 0;
        for (String s : set) {
            editor.putString(setName + "_" + i, s);
            ++i;
        }
        return editor.commit();
    }
}