I've just moved from Eclipse to android studio. One of my most used shortcut is ctrl-2 L, which will automatically assign a variable with a name and import the necessary class.
new View();
and press Ctrl-2 L, which results in:
View view = new View();
Is there a way to do it in android studio?
If you cursor is on the line and you hit CTRL + 1 you get a context menu to 'assign a new local variable', resulting in the following: String value = MyObject.
Easiest is, hit Alt + Enter , you will be offered with a list of options, and just select "Introduce local Variable".
You Can See Shortcut Key in Refactor -> Extract Menu
Mac Extract Variable Use Below Shortcut:
1- ⌥+⌘+V for local variable
2- ⌥+⌘+F for class/field variable
3- ⌥+⌘+C for constant
I think you must use Control+Alt key for Windows
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With