Header Ads

Few time saving tips on Android Studio

Some developers may already be using these methods to save some time. So if you haven’t, it may save a few minutes of your time.

Generate Getters and Setters in Android Studio

If you are creating a model class to store data with large number of variables, you may have manually created getters andsetters for all those variables. This may help you to save some time.
Right click anywhere inside the class. Select
Generate -> Getter and Setter
Now select the variables for which the getters and setters should be generated. Now Android Studio automatically generates it for you.
Shortcut Key
Alt + Enter -> Generate -> Getter and Setter
android studio

Implement Methods

Unimplemented methods in a interface can be implemented by using the shortcut key,
Ctrl + I
Command + I (Mac)
A dialog pops up. Then select OK.
Selection_015

Override Methods

To override a method from Super class you can use the shortcut key,
Ctrl + O
Command + O (Mac)
Selection_016

Creating Singleton Class

Right click on the package name. Select New ->Java Class
Select Kind as Singleton. Then enter a name and select OK.
Screenshot from 2016-02-13 19-35-11
Enjoy Coding :)

No comments:

Powered by Blogger.