How to automatically generate getters and setters in Android Studio

Ajay S picture Ajay S · May 27, 2014 · Viewed 212.4k times · Source

Is there a shortcut in Android Studio for automatically generating the getters and setters in a given class?

Answer

Ajay S picture Ajay S · May 27, 2014

Using Alt+ Insert for Windows or Command+ N for Mac in the editor, you may easily generate getter and setter methods for any fields of your class. This has the same effect as using the Menu Bar -> Code -> Generate...

enter image description here

and then using shift or control button, select all the variables you need to add getters and setters