Sure, a database would work, but, depending on how many colors you have, it might be overkill.

Also note that you don't have to use Android color resources unless it is actually convenient for your application.

I'd use a text file with simple "color: #abcdef" definitions, in res/raw to define the colors in the first place (so you could get the entire list for the user to pick from) and a database or SharedPreferences or a data file to save user selections.

-- Kostya

07.12.2010 18:18, Danny Schimke пишет:
The change of R was my guess too and the main reason why I asked here. Ahh, ok, I understand, you would save color names or the code like #RRGGBB. But what happens when I delete or change colors... Once a color is part of my app i can't remove it, cause users who used them saved the code or name into the database and then there is a problem...

What do you think about a separate database table? Not good?

Thank you!
-Danny Schimke

2010/12/7 Kostya Vasilyev <kmans...@gmail.com <mailto:kmans...@gmail.com>>

    Danny,

    The values in R can change as you add and remove resources.

    I'd say store color names, or actual RGB values (and match them to
    names when need to present to the user).

    -- Kostya

    07.12.2010 16:56, Danny Schimke пишет:

        Hi,

        I have 2 textual inputs that I saved to database, furthermore
        I have a spinner with color selection. Color names and color
        values both stored in the application resources. I want to
        save a color in the database, but what is the best way to do
        this in your mind? Should I save the resource id? I figured
        out, that the int value of the color resource is allways the
        same, e.g. when I delete the "R" file and let it recreate. I
        do not have the certainty that this is correct?!

        Or would you put colors in a seperate database table instead
        using resources for this? This seems to be a good way and the
        user is able to add own colors to the application.

        I don't know what is the best way to store this. What are your
        experiences?

        Thank you very much!
        -Danny Schimke
-- You received this message because you are subscribed to the Google
        Groups "Android Developers" group.
        To post to this group, send email to
        android-developers@googlegroups.com
        <mailto:android-developers@googlegroups.com>
        To unsubscribe from this group, send email to
        android-developers+unsubscr...@googlegroups.com
        <mailto:android-developers%2bunsubscr...@googlegroups.com>
        For more options, visit this group at
        http://groups.google.com/group/android-developers?hl=en



-- Kostya Vasilyev -- WiFi Manager + pretty widget --
    http://kmansoft.wordpress.com

-- You received this message because you are subscribed to the Google
    Groups "Android Developers" group.
    To post to this group, send email to
    android-developers@googlegroups.com
    <mailto:android-developers@googlegroups.com>
    To unsubscribe from this group, send email to
    android-developers+unsubscr...@googlegroups.com
    <mailto:android-developers%2bunsubscr...@googlegroups.com>
    For more options, visit this group at
    http://groups.google.com/group/android-developers?hl=en


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to