So DroidConUK is over for another year. This year was another excellent year with some great speakers and talks. I had an awesome time meeting new people, hearing new ideas and building on what I already knew. I thought I’d share a few of the key points that I am taking away this year to help reinforce some ideas, and not forget others.

Yo dawg, I heard you like RecyclerView

Lisa Wray gave an awesome talk on RecyclerView. The carousel example with a RecyclerView inside a RecyclerView was interesting, how deep can you go? Speaking of depth it’s incredible how much there is to RV as well. We saw rarer seen classes like DiffUtil and SnapHelper and how to use them. Also showcased were some helper libraries, Epoxy by AirBnb, and Lisa’s very own Groupie, check them out!

The quote of this talk goes to an audience member:

Shame! Shame! Shame!

Jacks aren’t dead, they’re only just getting started

We’ve had Retrolamba for some time now to help bridge the Java 6 to 8 gap, but this year we finally have official Java 8 support on Android using the Jack toolchain on Android N. It’s certainly not complete, but it’s a good start, we can take advantage of lambdas, method references, streams, default methods and more. Of course there are caveats and not all of this is backported. But if you’re lucky enough to be using minApi of 24, then this is good news (I’m hoping that in time, that statement won’t seem so crazy)! One of my questions around this was how it would affect the use of abstract classes. Do you think you’d prefer reducing the amount of state in a class by using an interface with default methods, and composing behaviour through implementing multiple interfaces rather than inheriting from an abstract class?

It was also interesting to see how with the Jack toolchain, you can reduce your resulting method count over Retrolamba when compiling lambda expressions.

Thanks to Alex Florescu and Andrew Lord for their talks on this.

Security goes CWAC

Scott Alexander-Bown knows a thing or two about security on Android, he literally wrote the book on it. Scott gave loads of practical advice in his talk about what the new security features we have on Android N, like a hardware backed keystore, scoped directory access and Direct Boot.

Direct Boot looks really useful, and it looks fairly easy to make your app Direct Boot aware. A great example of it’s use was allowing a user to access a web service after a reboot using read-only auth token, before the device is unlocked.

Another thing I learned about Direct Boot that I’ll share as a PSA: If you’re updating to 7.0 on an OTA update, you can’t take advantage of DirectBoot unless you factory reset and re-encrypt your device!!

There was also some interesting advice for those of us not using minApi 24. Including using CWAC-Security which backports some of the new Android M+ security features to older versions of Android, and advice on supporting Android M’s granular runtime permissions model.

Drawable all the things

Facebook’s Emil Sjölander and Pasquale Anatriello presented Components for Android. Having used React.js for front-end web dev, and tinkering a bit with some React Native as well, I found this really interesting. The programming model of React on Android is something of a dream come true. Essentially: layouts are written in a declarative looking Java syntax, which take immutable props and render a View as a pure function of its properties, using what look like Builders. There’s no XML to write and it all gets compiled down to native Views optimised for layout perf in the end, including offloading some of the layout pipeline from the render thread, which gives a huge boost in layout time. This is still a work in progress and there’s no official (or even unofficial, when pressed) release date on this. There’s also currently no visual editor for editing layouts or any layout preview, yet.

One of the more fascinating things in this talk however, was around converting Views to Drawables. The example they gave was mind blowing. Converting the whole layout of a single news item card, including multiple images and text, down to a single Drawable, which is manually drawn in Java. This massively increased the performance of rendering. Frames were ready to render after only a few milliseconds compared to the normal View based layout which broke the golden number of 16ms. Having said that, the code wasn’t pretty, and there were further tweaks required for RTL, Accessibility and touch handling support — all pretty important if you ask me. But I’m simply impressed that this was at all achievable. Layout and scroll performance are a personal favourite topic of mine, so I really enjoyed this talk.

Use the ^[MVCIP]+$ architecture for your next app

MVP? MVVM? God Activities? MVP+RxJava? Or something else completely? whatever your preference, there’s probably an example for you over at the Android Architecture Blueprints repo on GitHub. David González and Jose Alcérreca presented the repo, which is a joint effort between Google and the community, detailing how different approaches in application architecture can be used to solve the same problem. In this case: the classic ToDo list. The repo uses the Espresso UI tests as a contract, to verify that the current implementations, and any new alterative solutions, all behave the same. There was an interesting question as to whether or not examples like this should be included on the developer docs and guides at d.android.com, the simple answer was no. All of these approaches are valid and effective ways to solve this problem, so it makes sense that Google provides the framework, but doesn’t prescribe a right or wrong approach to using the framework in terms of architecture.

Another intention of this repo is to provide prefabricated base apps that are setup and ready to be built on. This gives developers, especially those new to the platform, a working starting point on which to create their app. Contributing to this repo is very welcome. Submit a new architecture idea, bug fix or general suggestion using a GitHub issue. I encourage you to check this out, if not to contribute then just to satisfy Nick Butchers thirst for stars.

You can’t say no to that face

View used Data Bind… it was super effective!

Fabio Collini gave us talk on Data Binding. Introduced at Google I/O 2015, this is now something we can use in production. I’d heard Lisa Wray talk about this in an episode of Fragmented recently (that you should definitely check out), which got me interested in Data Binding. Having now tried it myself it’s really easy to implement and pretty powerful too. The hard part here is having the discipline to avoiding putting any sort of logic in your XML.

Complex code in XML is NOT a best practice

Thankfully, it’s not too hard to write your own custom bindings, and an extremely useful one shown was a custom binding on view visibility. This allowed you to set a views visibility directly through the binding depending on some condition in the underlying POJO, rather than having lots of duplicate code to check a condition and then call your view to set it’s visibility appropriately. This, in combination with Recycler Views is definitely worth a try.

Moving Swiftly On

Darryl Bayliss braved the stage and made the bold move of discussing iOS at Android conference! Quite frankly, I think he’s totally got it right. There are differences but fundamentally the two platforms are different solutions to the same problem: wanting an awesome mobile app experience. I’ve written some iOS in the past in Swift and it’s an amazing language. If you’ve tried Kotlin you’ll find it almost identical in terms of features and syntax. I have my gripes with Xcode (which I’ll leave for another time), and the app submission process. But as Darryl points out there are many similarities to be found. For example, iOS has always had a much more powerful version of Androids new ConstraintLayout, but only recently in iOS9 got StackView, which is akin to Androids LinearLayout, which has been with us since the beginning. ViewControllers are very similar to Activities, with similar lifecycle methods and TableViewController is the iOS equivalent of ListView or RecyclerView. If you’ve got a Mac try writing an iOS app, you’ve got nothing to lose, except perhaps some disk space; Xcode is a beast of a program.

Be together, not the same

Roman Piel and Anastasia López discussed community and diversity with us in their lightning talk. This is one of the most important issues facing our community, and it’s great to see it getting some stage time in a very well put together, and quite funny presentation! I liked their actionable suggestions, such as just taking 5 minutes of your time a day to be more empathetic, and consider your co-workers, thinking about what you can do to help them with whatever issue you think they may have (code or not code). Diversity brings ideas, and we as a community want to be welcoming to anyone regardless of background, ethnicity, sexual orientation or gender, to bring the best ideas to the table. If you missed this and stay in London, then get yourself to Novembers Londroid meetup to see it.

P.S. If you are in London and want to get involved with helping new developers get started with Android, then we’re still looking for a few coaches for the Codebar Android workshop on the 17th Nov. Give me a shout on Twitter if you’re interested.

If you keep your signing configs in your build.gradle file, you’re gonna have a bad time

This came up in a discussion at a post DroidCon party, as something noteworthy from a talk by Ana Baotić. You probably don’t want to be committing your keystore passwords to a git repo, public or private. There are safer ways to do this, such as using your user gradle.properties file and exposing some constants, which you can reference in your apps build.gradle , this should work locally and on any CI server as well. See this SO post for a good approach. Ana went over other common best practices and pitfalls in app security, so her talk is well worth a watch.

We have an awesome community, get out there and get involved!

This was just a small sample of the great stuff on offer at Droidcon this year. I didn’t make it to all of the talks I wanted to see, but it’s about more than just the talks. DroidCon is a great environment to meet new people and get to know the community. It’s also a brilliant place to network and find your next potential co-workers or employers, which was great for me as I’m currently job hunting, (Hi, hiring managers!!). If you went this year, I hope you enjoyed it, I’ll definitely be back again next year. Until then, if you feel like getting in touch, you can find me on Twitter. But before I end, I’ll leave you with news that:

Dyson makes taps and they violate the Single Responsibility Principle!

These crazy but cool taps were in the bathrooms at the Business Design Centre where DroidConUK is hosted. FYI: water comes out of the end of the tap and the “wings” are the hand dryers… What a time to be alive.