Quickly extract a literal string from an xml file

As you are building an app it is fiddly to have to constantly open strings.xml to add new strings as you name the parts of the app. The latest version of the eclipse tools support automatic extraction of literal strings.
Say you enter something like this in an xml editor:

android:title="An interesting page"

Really this should be pulled out to the strings.xml file where it is easier to localise and change.
So, hit ctrl+1 to carry out a quick-fix. One of the quick fixes suggested will be 'Extract Android String'. Pick this. This opens the strings editor form and populates it with your string and an underscore separated version of it as a key. Edit what you want and then hit return to save.

All done. Constantly going to string.xml was a pain and I was often not bothering. This quick fix takes away that excuse :)

Comments

Popular posts from this blog

Building a choropleth map for Irish agricultural data

Early Stopping with Keras

AutoCompleteTextView backed with data from SQLite in Android