Refactor code

Gemini in Android Studio streamlines your workflow and makes it easier to keep your code organized with AI-powered refactoring features.

Rename a specific variable

If you want to rename a specific variable, class, or method, you can right-click and select Refactor > Rename to get suggestions. Gemini suggests appropriate names based on the code context.

The code editor's 'Rename' refactoring action displaying name
          suggestions.
Gemini can suggest names for classes, methods, and variables during refactoring.

Rethink variable names

Gemini can suggest names for all variables or methods in a section of code based on the code context, so that names are more intuitive and descriptive. Right-click in the code editor and select Gemini > Rethink variable names. A dialog appears where you can review the suggested names and accept only the ones you like.

The 'Rename Local Variables' dialog with alternative name
         suggestions.
Gemini can suggest alternative names for variables in a file.