Get/set Gallery Show Mode
import android.app.Activity;
import android.content.SharedPreferences;
/**
* @author Artem Stasuk (artem.stasuk@gmail.com)
*/
final class SharedUtils {
private static final String SHARED_NAME = "SETTINGS";
private static final String GALLERY_SHOW_MODE = "GALLERY_SHOW_MODE";
public static boolean getGalleryShowMode(final Activity activity) {
final SharedPreferences settings = activity.getSharedPreferences(SHARED_NAME, 0);
return settings.getBoolean(GALLERY_SHOW_MODE, true);
}
public static void putGalleryShowMode(final Activity activity, final boolean value) {
final SharedPreferences settings = activity.getSharedPreferences(SHARED_NAME, 0);
final SharedPreferences.Editor edit = settings.edit();
edit.putBoolean(GALLERY_SHOW_MODE, value);
edit.commit();
}
}
Related examples in the same category