K
K
Konstantin Dovnar2015-10-13 17:44:12
Android
Konstantin Dovnar, 2015-10-13 17:44:12

Strings for everything?

Your application must use keys for SharedPreference in both XML files and code.
Up to this point, I kept the keys in strings.xml, working with them like this.
But now there is a need to store these keys also as public final static String in the class, for convenience, but in order to get them we need a Context to access resources from it.
Do I understand correctly that there is no convenient way to combine strings in xml and code, and you either need to store two instances (one in strings.xml, the other in code), or be sure to initialize them through Context?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Олег Гамега, 2015-10-13
@gadfi

все верно, а в чем проблема то ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question