Вопрос

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?

Это было полезно?

Решение

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.

Другие советы

There is the Eclipse's option: Source / Externalize strings, which externalizes the strings of a class into a .properties file, but it does not seem to be able to export them directly to strings.xml in the Android way.

If you're using eclipse, you can highlight the string you want extracted to strings.xml, press Alt + Shift + A and in the small pop-up on the lower right of the screen select "Extract Android String"

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top