Almost one month ago we watched Google I/O 2016 looking for new solutions for our work. It is always informative event with many presentations – for Android there are 65 of them. Fortunately, you can see them all on YouTube – click to open playlist.

Part of our team chose some of the presentations that we found interesting and today we are sharing them with you.

Vector drawables

Michał Chojnacki: Android applications most often use bitmaps for drawing icons and drawables. With increasing resolution of phones’ and tablets’ screens also size of raster graphic files started growing quite excessively. Solution – vector graphics was introduced with Android Lollipop and has been limited to devices running on API 21 or higher. This solution enables developers to create only one file which scales to proper size instead of couple ones for different screen densities.

With Android Support Library revision 23.2.0 this solution also became available for older devices with two new classes: VectorDrawableCompat which can be used from API 7 and animated drawable AnimatedVectorDrawableCompat from API 11. For this reason during last Google I/O conference developers were encouraged to use them in their applications. You can see below how to start with vector drawables or watch the presentation.

To use this library, it is first necessary to configure build.gradle file by setting vectorDrawables.useSupportLibrary parameter as true.

  

Vector drawables can be used with new attribute app:srcCompat or in runtime with method setImageResource as with standard graphics.

  

To create vector file only needed is to create one file in drawable resources with tags with data inside it surrounded with tags, which contains information written in SVG format. Such files can be generated by Android Studio.

  

Converting vector graphics to traditional png files shows advantage over the second solution. On the screen shot below with svg file on the right and the same graphics in png of resolution 144×144 on the left, you can see the difference is significant. Moreover weight of 4 files – from this example – for different Android densities from mdpi to xxdpi is 5,5 kilobytes when single svg file is only 600 bytes. Hence developers can save a lot of space with vectors.

vd-drawable4

Firebase

Piotr Ekert: At the latest Google I/O keynote, Firebase, known as “backend-as-a-service (BaaS) that handles the heavy lifting of building an app” was announced as complete solution for building and maintaining an app during Android, iOS and mobile web development.

Firebase features

With this announcement many previously paid features became free. For example, the new Firebase Cloud Messaging service, made to push messages from the cloud to Android, iOS, and web devices is now free with unlimited usage. Also worth a look is Firebase Notifications, which would let you send notifications without any line of code. Finally, any files generated by you can be now uploaded to Firebase Storage built on Google’s Cloud Storage.

How about new functionalities? Firebase has now also its own Crash Reporting service which gives developers prioritized, actionable reports to help them diagnose and fix problems in their iOS or Android app after it has shipped. Tied with Firebase Analytics, developer will be able to see information about how and where an app is being used. With Firebase Test Lab, developers will be able to virtually test how an app runs on real Android devices with different screen sizes and specs.

Firebase is also tightly integrated with Google AdWords and AdMobs to help developer monetize apps . Furthermore, it includes app indexing features that to let an app be easily accessed from search results. If you wish to learn more about these new features please see the collection of videos.

Advanced Data Binding

Bartek Kwiatkowski: One year ago Data Binding was announced at Google I/O 2015. The library has a great purpose to get rid of findViewById and declaring Views in Java code after it was already done in XML layout. It was released as beta version and had some bugs but was developing quickly and we have created two new applications with Data Binding. I am glad to see, that this library now offers two-way data binding and it’s easier get value from a View. For example, you do not have to declare TextWatcher to get value from EditText. Of course it is possible to declare your own getters.

  

Another clever feature is Repeated Expression which lets you use expression defined in one view in other views.

  

Method References and Lambda Expressions are two solutions for handling UI actions. The first one is more old-school and you have to handle original Android methods like onClick(View v) while Lambda makes it shorter and you can pass object from layout as an argument of the method.

  
  

Of course there are many more features: referring to View in layout using its’ id written in camel-case, using Context by context variable, applying simple animations with Transitions and more. Watch the presentation to get more information and if you are interested in how it all looked a year ago check out my article.