5

I searched on the web on how to modify or create a string in Android Studio, but didn't find any information on shortcuts.

I just want to modify the @string/app_name from Basic App to My app for example.

I know that I can manually navigate to strings.xml to achieve this, but is there a faster method via shortcut?

Mouser
  • 13,132
  • 3
  • 28
  • 54
Félix Desjardins
  • 3,223
  • 3
  • 21
  • 36

3 Answers3

9

In Android Studio

  1. to rename string either file

WINDOWS Ctrl + F6

MAC fn + Shift + F6

  1. "extract string resource" to create new string under file resources/string

WINDOWS Alt + Enter

MAC Alt + Enter

I also encourage you guys to see this video which shows some other trick, you may use in order to speed up your programming.

murt
  • 3,790
  • 4
  • 37
  • 48
  • If you Alt + Enter First time it will ask for Extract String Resource -> Edit Intention Settings -> Accept the dialog. After this you will get the direct popup to add to strings.xml file. – Nizamudeen Sherif Nov 21 '19 at 14:44
2

Using Mac 10.5+ shortcuts, highlighting a symbol (e.g. method, reference to a resource) and pressing Command+B will take you directly to where that symbol is defined.

On Windows it's Ctrl+B.

stkent
  • 19,772
  • 14
  • 85
  • 111
0

One more option is there with plugin type

Android: Automatic string extraction

link string extractor plugin

**<!-- Before, Layout: example.xml -->
<TextView
  android:id="@+id/textView"
  android:text="Hardcoded value"
  />

<!-- After -->
<TextView
  android:id="@+id/textView"
  android:text="@string/example_textView_text"
  />**

you can try this, and for elaboration see this post.

Tomer Shetah
  • 8,413
  • 7
  • 27
  • 35
btm me
  • 368
  • 3
  • 11