Improving Productivity By Using Plugins in Android Studio
Posted By : Daljeet Singh | 26-Feb-2018
Android developers spend a large part of their time writing,rewriting and replicating the same blocks of code or design over and over again.The time required to perform these tedious tasks can be reduced significantly by using plugins for android studio. Android studio provides us with a variety of plugins to improve coding productivity and efficiency.Here are some of the plugins that I have particularly found to be useful:
-
DTO Generator : More often than not, we find ourselves creating POJO classes to store JSON data from a server.This process can be pretty tedious and repetitive,however using the DTO Generator plugin this can be achieved in a couple of clicks.After adding the DTO Generator plugin,right click inside your class and select generate->DTO from JSON option.Paste your json inside the dialog that follows and select whether you want to make fields private and use getters and setters for them.
-
ButterKnife Zelezny : This plugin is a personal favorite of mine.It saves an android developer countless minutes of writing code for binding views and defining the onClick methods for the views in the activity.After adding the plugin in android studio ,just right-click on the layout for the activity or fragment inside the setContentView() method and select the generate->generate butterknife injections option.A dialog will pop up displaying the list of views/viewgroups in your layout that have an id and would provide default names for the variables to be used to bind these views.The dialog would also provide you with an option to add onClick methods for any of these views.
-
Exynap : The Exynap plugin helps one generate boilerplate code inside an android app in the form of snippets in an instant.After adding the plugin in android studio,the Exynap option appears in the toolbar.To insert commonly used code snippets in your app,just click on the Exynap option in the toolbar and select the enter command option.In the dialog box that pops up after this,enter the command for which you want to generate code such as "create an alert dialog","create a custom recyclerview adapter","hide keyboard" etc. and boilerplate code for the same would automatically be generated.You can also add your custom code snippets to be used throughout the in Exynap using the Add Snippet option.
-
Android DPI Calculator : While designing apps,we need to adjust the view sizes and margins according to the different densities(mdpi,hdpi,xhdpi etc.),in order for the app to have a uniform UI across the different screen sizes.To achieve this consistency of UI,we need to define different values for a dimension across the different densities.For instance, a 48dp dimension value in mdpi would be equal to 72dp,96dp,144dp and 192dp in hdpi,xhdpi,xxhdpi and xxxhdpi respectively.The android dpi calculator plugin helps you calculate sizes in different densities by specifying it in any one of the densities.You can find this plugin inside Tools->Android->DPI calculator after adding it from the settings menu.
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Daljeet Singh
Daljeet has experience developing android applications across a range of domains such as Cryptocurrency, Travel & Hotel Booking, Video Streaming and e-commerce. In his free time, he can be found playing/watching a game of football or reading up on either