Assign to new local variable shortcut (ctrl-2 L) in android studio


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?


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

enter image description here

Answered By – Ahmad Ronagh

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published