Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there way for extracting string resources in Android project in IntelliJ IDE?

When I'm working on Android project I would like to use some magic shortcut that would extract my string to strings.xml and also allow me to change the key. Is there any?

If there isn't, is there a way to develop new refactorization methods and extend IntelliJ possibilities?

like image 487
Michal Chudy Avatar asked Aug 21 '11 21:08

Michal Chudy


People also ask

Which can be used for extracting hard coded strings from the code to resource files?

IntelliJ IDEA provides a special intention action i18nize hard coded string literal to extract string literals into your properties files. You can access the resource bundle using either the java.

Which file is used to store string resources in Android project?

So, you can combine string resources with other simple resources in the one XML file, under one <resources> element. The filename is arbitrary. The <string> element's name is used as the resource ID.

Why should you use string resources instead of hard coded strings in your apps?

It allows you to easily locate text in your app and later have it translated. Strings can be internationalized easily, allowing your application to support multiple languages with a single application package file (APK).


1 Answers

Alt+Enter (to invoke intention action menu) on a string, then use Add a string resource action from the menu.

To rename resource use Refactor | Rename while standing on a resource name in Java code, it will rename all the references and the resource itself.

like image 120
CrazyCoder Avatar answered Oct 08 '22 03:10

CrazyCoder