简体   繁体   中英

How can IntelliJ refactor class constants to an external class?

I have a series of 30 or so private class constants declared and used in Fragment.java. I want to refactor the declarations into public declarations in Constants.java such that all occurrences of VARIABLE_NAME in Fragment.java are replaced with Constants.VARIABLE_NAME

Tips appreciated on how to use this. I am using Android Studio built on top of IntelliJ.

Click the menu "Refactor", and choose "Move...". Then select the constants you want to move and enter the class where you want to move them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM