Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Externalize strings for Android project

Is there any Eclipse plugin that takes strings from code and puts them in strings.xml? I found "Externalize strings" function in Eclipse, but I don't know how to get it to work with strings.xml.

like image 320
Denis Palnitsky Avatar asked Dec 24 '10 15:12

Denis Palnitsky


2 Answers

Use Refactor in Eclipse:

  • highlight the string
  • From the Eclipse menu select Refactor -> Android -> Extract Android String.

The string will be moved to strings.xml and the call to getContext().getString(R.string.my_string) generated.

like image 181
Diego Torres Milano Avatar answered Oct 20 '22 07:10

Diego Torres Milano


You can also position your cursor over the string literal and press ctrl+1. Then choose "externalize" by the android icon.

Credits: Do externalized strings need to be in strings.xml?

like image 37
Cléssio Mendes Avatar answered Oct 20 '22 08:10

Cléssio Mendes