Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNoam Elbaz
5,672 PointsAndroid Studio - Extract a string - (Refactor)
The video called "Easy sharing Intents" Ben extracts a string from code and easily refactors to strings.xml in Eclipse. I'm on Android Studio.
Anybody know how to do it?
I tried highlighting the string and "Reactor" ... but i did not see anything that matched.
I tried Googling it but no success.
Thanks
Patrick Allwood
7,463 PointsHighlight the string and click alt/option and enter (on a mac). This will bring up a context menu which will give you the option to extract a string resource.
Ralph Cacho
8,698 PointsPlace your mouse cursor over the string you want to extract and click once. A yellow light bulb (warning) should show up to the left between the line numbers and the of the line of code. Click the light bulb and select "Extract string resource" then fill in the appropriate fields. Hope this helps!
1 Answer
Ian B
2,688 PointsHighlight the text and then press Alt + Enter. Select it from the options that appear.
Mohammad Abdirashid
8,211 PointsMohammad Abdirashid
8,211 PointsHighlight the String you want to refactor to create the string, and then use Shift + F6
I use Mac, and use fn+shift+f6