Get/set Gallery Show Mode : Gallery « UI « Android






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

1.Using Gallery widget
2.Media Store Gallery
3.Honeycomb Gallery
4.Gallery View
5.CoverFlow extends Gallery