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?

0

3 Answers 3

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.

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

1 Comment

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.
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.

Comments

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.

Comments

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.