Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Function to turn local variable into class variable

How to add these two functions to android studio, to turn a existing (not accessible) variable into a private/public? The screenshot is faked and not real, but it is the aim of my question.

To turn a local variable into private/public I have to do the following steps:
- Cut [variable-class] [variable-name]
- Write [private/public]
- Change cursor position to class-head
- Paste [variable-class] [variable-name]
- Copy [variable-name]
- Change cursor position to class-method
- Paste [variable-name]

enter image description here

like image 812
Tomblarom Avatar asked Nov 29 '22 10:11

Tomblarom


1 Answers

Ctrl+Alt+F will extract your local variable into the class field.
To learn other available refactorings, you can read the Intellij Idea Reference Card.

like image 174
aga Avatar answered Feb 23 '23 18:02

aga