How do I store common channels?
source link: https://www.codesd.com/item/how-do-i-store-common-channels.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How do I store common channels?
I can store them in res/strings
<resources>
<string name="str1">app</string>
</resources>
And I can store them in static const
public static final string str1 = "app"
Which one is better?
I mean that which one will use more memory and which one will make package larger.
If you have to change some text in your app's view, then you don't have to find where you have written that text. You simply go to the
strings.xml
inres
folder and can change the string. For that reason, the first option will always be the better option.If you want a string that will be used as a key in your app then you can store it in a static constant variable. Like: If you want to pass data through
intent
or in any other way, at that time you have to pass a key. That key will be a string and can be stored in a static constant variable.
Related Articles
How do I store two channels for a Mac application?
How to properly store a common code using CVS or SVN with a team
How to name my RGB channels, using cv :: Mat_
How can I store and access a type dynamically in c ++?
How do I store and retrieve a NSMutableDictionary from NSUserDefaults?
How do compilers store hundreds of variables in just a few registers?
How to organize the common code
How can I store a reference to an object defined in another thread?
How can I store the expiry date of a credit card if it only includes the month and the year?
How do I store passwords?
How do I store this in Redis?
How do you store an IP address (v4 or v6) as an int in any database using php?
Flacon: How to manually store session data
How can I store a time_t time stamp in a file using C?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK