Reputation: 5049
Trying to go from eclipse where you can go over some text, do ctrl-1, select something like create/extract constant, and then it will automatically create it.
The equivalent is roughly ctrl-shift-alt-T, then select from the listing.
Unfortunately in Android Studio, I keep getting:
"cannot perform refactoring. unknown expression type."
Is there any way around this?
What confuses me is that the little lightbulb pops up, and I can click on that, and create constant through there works (and it knows the correct type, etc.).
An alternative acceptable answer would be how to automatically select the little lightbulb that pops up with a keyboard shortcut
Upvotes: 6
Views: 5732
Reputation: 18454
On mac, Android Studio/Preferences/Keymap, search "constant", add or replace with any hotkey you want. I used Eclipse hotkey so it is not available by default.
Upvotes: 0
Reputation: 31
Select the String that need to be converted into the constant use CTRL + ALT + C (on Windows) or Cmd + ALT + C (on Mac OS) For more details I think the flowing link gonna help you Extract Constant
Upvotes: 1
Reputation: 441
Select the String that need to be converted into the constant
use CTRL + ALT + C (on Windows) or Cmd + ALT + C (on Mac OS)
For more details I think the flowing link gonna help you Extract Constant
Upvotes: 8