Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

@SharedPref should support Set<String> #264

Description

@ericbottard

It is my understanding that SharedPreferences has getStringSet() / putStringSet() to allow retrieval of several Strings at once.

An annotated @SharedPref interface should allow a return type of Set

Activity

  1. pyricau commented on Jul 5, 2012

    @pyricau
    Contributor

    That's something we considered. The problem is that, as you can see [here](http://developer.android.com/reference/android/content/SharedPreferences.html#getStringSet(java.lang.String, java.util.Set<java.lang.String>), those methods appeared in API Level 11. So that means we should provide an alternate implementation for pre Android 11 runtimes.

  2. ericbottard commented on Jul 5, 2012

    @ericbottard
    Author

    I think it's better, even if you don't provide an alternate impl, to support it. Of course, converting from one String to Set and back on pre11 would bring even more value from AA.

  3. pyricau commented on Jul 5, 2012

    @pyricau
    Contributor

    How'd you convert Set => String ? We need a separator, but I'm not sure there's a good separator.

  4. ericbottard commented on Jul 5, 2012

    @ericbottard
    Author

    You need an escaping mechanism (e.g. '') and then any char would do. Make sure that for example | is your separator, | resolves to | and \ resolves to .
    Or go for a long string that regular users would definitely use in their own strings.

  5. naixx commented on Jul 9, 2012

    @naixx
    Contributor

    One could use json to serialize StringSet to String

  6. added a commit that references this issue on Mar 29, 2013
  7. modified the milestones: 3.1, Someday on Jun 9, 2014
  8. WonderCsabo commented on Aug 22, 2014

    @WonderCsabo
    Member

    Already implemented. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions