[Android Studio] Hardcoded string Button, should use @string resource


Warning Message:

Hardcoded string "Button", should use @string resource

Hardcoding text attributes directly in layout files is bad for several reasons:

* When creating configuration variations (for example for landscape or portrait) you have to repeat the actual text (and keep it up to date when making changes)

* The application cannot be translated to other languages by just adding new translations for existing string resources.

There are quick-fixes to automatically extract this hardcoded string into a resource lookup.

Issue id: HardcodedText
Suggested Fix: Extract string resource.

This is the most common warning message you may get while working with the Android Studio Design/Code layout for your Android activity.

Fixing Hardcoded string issues are simple, just click on fix under the Suggested Fix section and you would see the dialog "Extract Resource", enter Resouce Name, Value, Source and add it to the file string.xml.

Hardcoded string Button should use at string resource
Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap