9

I find it a waste of time that every time I need to enter a string that I have to go edit the strings.xml file manually. What I'd like to be able to do ideally is have Eclipse pop up a dialog box that lets me specify the name of the resource and the value for it. Then Eclipse would generate the code in strings.xml and paste the correct reference to the string at the cursor position.

Does such a facility exist?

1 Answer 1

18

Select a String, click Refactor --> Android --> Extract Android String.

Sign up to request clarification or add additional context in comments.

4 Comments

That's awesome, thanks! I never noticed the android submenu in the refactoring and found no mention of this in the ADT instructions on the android developer pages. Is there a list of supported refactorings (since they seem to be context sensitive?) Thanks!
I have never seen anything else other than "Extract Android String" in the Android refactoring submenu; although it is context sensitive the "Extract Android Substring" option always appears, albeit sometimes greyed out. I have nothing official to back me up unfortunately!
Pressing Ctrl+1 when the cursor is within the string is a faster method.
There appear to be several new Android refactorings available since @antonyt commented.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.