Arrange string resources based on screens
See original GitHub issueDescribe the bug
Currently string resources are not organised correctly and are scattered in strings.xml
file.
This should be fixed by following these points:
- Make sure that each string is getting used in one specific view only. For example
Home
is part of multiple views likeNavigation Drawer
,Home-Toolbar
. So for this we should have separate strings for both. - All strings related to one activity/fragment should be kept together by mentioning the activity name on top of the strings in a comment. Example:
<!-- ProfileResetPinActivity -->
- All activities/fragment sections should be in correct alphabetical order based on activity/fragment name. (The actual strings name are not required to be in alphabetical order but the comments should be in alphabetical order). Example:
<!-- HomeActivity -->
<string name="random_string_related_to_home">ABC</string>
<!-- ProfileResetPinActivity -->
<string name="random_string_related_to_profile_resent_pin">ABC</string>
<string name="random_string_related_to_profile_resent_pin_2">XYZ</string>
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Different strings for different screen sizes - android
Why is it happening? Edit: All the strings are located in values/strings.xml. For the "small"(first) device I need to override some ...
Read more >String resources - Android Developers
A string resource provides text strings for your application with optional text styling and formatting. There are three types of resources ...
Read more >How to name your string resources in strings.xml in Android?
The basic way a string resource is written in Android is the ... In my Summary Screen I want to show the message...
Read more >How do you organize your String resources? : r/androiddev
Lets say you have a label "First Name" on two different screens in your app. Do you make two different string resource entries...
Read more >How to Display Styled Text from String Resources in Android ...
In Android, we can store fixed strings in resources as well as hard code them in the front-end. When we store them in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If a string is not getting used anywhere, it should be removed.
Don’t create separate strings right now. If its needed I will mention in PR. Comments can be related to menu file where they are getting used.
Yes, a list of strings should be combined based on screen/feature and not on file-to-file basis.
It would be great if they start with
test_
prefix.The replies might change in PR because here I don’t have exact example with your questions. So I think better you create a PR with your judgement and there the conversation can be a bit easy. Thanks.
I would like to work on this.