Change Variable Name Android Studio


I would like to change the name of all the variables that have the same name. Do you know any commands? Android Studio

asked by zzxbx 10.12.2017 в 00:39

3 answers


Better use the "Refactoring" function (Refactor) that Android Studio itself has.

Step by step:

  • Right button on the variable
  • Choose "Refactor" - > Rename
  • Write directly the new name
  • Press ENTER
answered by 11.12.2017 / 10:53

On Windows:

Search: Ctrl + F

Find and Replace in a single class: Ctrl + R

Search and replace in a complete project: Ctrl + Shift + R

on OS X, it's similar, it just replaces Ctrl with Command

answered by 10.12.2017 в 06:35

One of the functions of the IDE Android Studio is precisely the refactoring


Refactoring means making small changes to improve the structure of a program without affecting its operation.

Involves renaming variables in all your project in a safe way without affecting the operation of it.

There are two ways to Activate refactoring:

1) Select the variable and activate the refactoring using the sequence:   Shift + F6

2) Select the variable or by right clicking on it, select:

Refactor > Rename

Of these two forms you can activate the refactoring and you can make the change in the name of the variable, which changes globally in your project:

answered by 12.12.2017 в 16:33