Android developers now have access to Gradle Kotlin DSL v1.0! This means that we can write Gradle build scripts in our favorite language, Kotlin. Here, we’ll convert an Android project using a Groovy Gradle script to use a Kotlin Gradle script.
Android developers now have access to Gradle Kotlin DSL v1.0! This means that we can write Gradle build scripts in our favorite language, Kotlin. Here, we’ll convert an Android project using a Groovy Gradle script to use a Kotlin Gradle script.
Android Tools Attributes are a critical element of any well designed app that uses DataBinding, RecyclerViews or top level navigation, such as a Navigation Drawer or Bottom Navigation View. This post teaches the importance of using them and how you can apply them to your project provide design-time hints to Android Studio about what type of data and attributes will be applied to your views at runtime, so that it can render them at design time.
Dependency injection is a great tool to break up your dependency creation into reuseable pieces. This helps separate your code into logical chunks where some create the dependencies and other consume them. This separation helps in your unit tests because you have a clear list of dependencies for each object so you can easily pass in mock versions.
TalkBack is Google’s screen reader for Android devices. It’s hard to understand accessibility issues without experiencing them yourself. Take 5 minutes to read this article, download its cheatsheet, and then go explore your app with fingers and ears for the first time. You might be surprised by what you find.
Every year brings changes in tech. Here are some of the things I’m excited to learn more about in 2019.
When a Kotlin non-null property turns up null, you know something has gone subtly, yet terribly, wrong. You trusted that type system, and it let you down. But how? How does the impossible happen? We’ll get to the bottom of this!
Last week, a few nerds at Big Nerd Ranch attended Android Dev Summit. While the conference covered multiple topics, the biggest piece of news was support for foldable devices.
Over the past few months, Kristin Marsicano, myself, and many others on the Android team here at Big Nerd Ranch have worked on the fourth edition of our Android Programming book. Keep reading to find out what’s in store!
While basic slices have their place, you will often want to provide users with additional information or controls. Range actions make your Slices more interactive by allowing users to control any field that accepts a discrete range of options, such as volume or brightness.
Returning for a second year, KotlinConf is the place to learn about new Kotlin language advancements straight from the source - the language designers themselves.
While basic slices have their place, you will often want to provide uers with additional information or controls. Toggle actions make your Slices more interactive by providing a way for users to enable or disable certain controls in your application.
While basic slices have their place, you will often want to provide uers with additional information or controls. One way to make a Slice more interactive is to provide multiple actions. These show up as tappable icons that will take the user to different screens in your app, or take the user to the same screen with different sets of data.
Providing users quick access to data and controls for your app is a good user experience, it lets them see the info they care about in the places that are important to them.
This article explores the usefulness of Kotlin’s Nothing type in generics. We look at its relationship to Java. To take a concrete example, let’s look at a linked list.
The day is finally here: our guide to the Kotlin programming language will soon be on store shelves
Adding machine learning and AI into mobile apps became easier with Google’s Firebase MLKit. Last year, Google democratized AI. This year, they commoditized it.
The Navigation component is comprised of a set of tools, APIs and resources, that allow you to build your app navigation declaratively and visually. It makes certain tasks which used to be fairly tedious, like animating screen transitions and creating deep links into your application, now very easy.
One exciting announcement from this year’s Google I/O is the new Material Theming. Google realized that Material Design seemed to push some designers and companies away because they thought it was too restrictive and they wouldn’t be able to represent their branding using it. To help onboard more people, Google is offering more guidance on how to customize Material Design for your specific needs. They’re now calling this Material Theming.
Google announced a really exciting feature at this year’s Google I/O that allows developers to perform background tasks that would traditionally require detailed knowledge of various API levels and the background task libraries available for those APIs. WorkManager offers up the functionality that you would get from other APIs such as JobScheduler, FirebaseJobDispatcher, AlarmManager and Services, without the overhead of having to research which one is available for your device or API.
Android will be 10 years old this year and the team at Google introduced plenty of new updates at Google I/O on May 8th. These changes range from user-facing improvements to API updates that developers will be able to take advantage of in the near future. If you weren’t able to attend I/O this year or watch the recordings on Youtube, I’ll recap some of what you missed.
Auto Backup is a nifty feature introduced in Android 6.0 (23) that allows users to have the data from their apps backed up onto their Google Drive accounts. You can leverage auto backup in your Android app so that your users can more quickly recover their data if they ever switch phones or reinstall your app after having uninstalled it.
Big Nerd Ranch’s newest offering is officially live. The Frontier is a screencast series built to advance your iOS or Android skills with expert instructors, on your time and at your pace. I’ll share a little bit more on why we created The Frontier.
This year is the first year of KotlinConf, JetBrains’s annual conference for sharing with the world all things Kotlin, straight from the architects of the language itself.
One thing that sets Big Nerd Ranch instructors apart is we consider ourselves students first. That’s definitely the case with Kristin Marsicano, whose passion for learning and asking questions has solidified her as an Android expert in a few short years. Her advice to all her fellow programmers out there might surprise you.
Big Nerd Ranch was founded on the idea that developers learn best when immersed in a distraction-free environment. Today I want to talk to you about a new path to advance your skills; one that doesn’t look like anything we’ve offered before.
Use lateinit for view properties in activities and fragments. While lazy is appealing, it has some rough corners.
Codify your functions’ assumptions and promises using Kotlin’s common language of
assert. Jumpstart your debugging with mind-reading failure messages.
Rolling your own image loading solution in Android is hard and likely to be incomplete. This post takes a look at the three most popular options to help you make a decision on which library to use. Discover the differences and the similarities between Picasso, Glide and Fresco.
In Part 1 we set up our BLE Server and Client and were able to connect them. Now it’s time to take a look at how to work with GATT Characteristics to send and receive data.
Data Binding is a powerful library that’s built around the idea of keeping your views up-to-date with your model. One of the lesser-known features is that it also lets you go backwards here. Using two-way Data Binding lets your model objects observe your views without the need to attach a listener to the view yourself.
It has always been possible to use Kotlin on the server. Numerous Java server frameworks happily run any JVM bytecode, whether the code was originally written in Java, Kotlin, Scala or even JRuby. But if you are an Android developer who wants to build simple JSON APIs for your apps, why not use a framework that was written in Kotlin by people who brought you Kotlin?
There are many resources available on Bluetooth on Android, but unfortunately many are incomplete snippets, use out-of-date concepts, or only explain half of the puzzle! In this series, we will learn how to set up both a Bluetooth Low Energy (BLE) Client and Server and demistify the Generic Attribute Profile (GATT) communication process.
Mockito, the popular Java test double library, got a major version bump last fall. We’ve been watching it ever since, and are excited about a lot of the new features available. That said, there also some things to watch out for.
Room is a new way to save application data in your Android app announced at Google I/O this year. It’s part of the new Android Architecture components, a group of libraries from Google that support an opinionated application architecture. Room is offered as a high-level, first-party alternative to Realm, ORMLite, GreenDao and many others.
With iOS 11 and Android O launching later this year, you may be curious as to whether or not you should spend the money updating your apps. The answer is a resounding yes. Here’s why.
We’re kicking off a series of posts that demonstrate what Kotlin offers by migrating a 100% Java Android app to be a 100% Kotlin Android app. In this first post, we’ll get our project configured to use Kotlin and go through converting our first file.
Developers are excited about official support for Kotlin on Android, but what does this mean for business owners? Is this a positive change, or a burden?
Google surprised many at its 2017 I/O keynote by introducing Kotlin as a first-party language. This day has been long-awaited at Big Nerd Ranch—we’ve been writing Kotlin apps internally and have fallen in love with its concise syntax and safety. Now that Kotlin has the official seal of approval, let’s talk about what it can do for you.
Google has made a lot of interesting announcements at this year’s Google I/O. Here’s what we’re most excited about.
With the introduction of the Android O preview, we’ve gotten a look at how Google intends to tidy up the home screen through Adaptive Icons. In this post, we’ll be highlighting how this changes creating production assets, what to consider when designing your adaptive icon, and introducing our adaptive icon sketch template.
The journey to the tech industry isn’t always from Point A to Point B. In fact, it often involves many twists and turns (and sometimes even a roundabout) to get to where you’re supposed to be. This blog posts highlights my personal experience from coding amateur to Big Nerd Ranch employee.
As developers, we usually think of security from the perspective of the platform and applications. But we should not forget the humans for whom we create our applications.
When a custom designed UI is first implemented in an Android build, I often find the styling and nuances of the typography gets lost in translation. Adjusting some basic (but often overlooked) type characteristics can help preserve some of that appeal.
What happens if a network request is made using RxJava & Retrofit, a user rotates the phone, and the request hasn’t completed yet? By default, the Observable will be recreated, the request re-requested, and the previous data lost! Take a look at a solution to this common problem: the Repository pattern.
Many companies believe that developing an app for their company means only developing an iOS app. Here are three reasons why you should consider building an Android app too.
Chris has been lucky enough to read the 3rd edition of Android Programming: The Big Nerd Ranch Guide early (because he helped write it) and now he wants to tell you about it.
Whenever we start a new edition of the Android book, our first question is what you would expect—what new things do we want to put in the book? And for many books, that would be the start and end of it. However, at Big Nerd Ranch, things can be a bit more complicated.
We talked about the ConstraintLayout in a previous post and compared it to Apple’s Auto Layout. Since then, ConstraintLayout has gone from alpha to beta, and the latest version packs further speed improvements and fixes. Furthermore, Android Studio 2.3 made improvements to the editor. In this post, we’ll explore some examples of user interfaces you can create with ConstraintLayout.
Depending on who you’re talking to, MVVM can mean different things. In this post, I’m going to present a few approaches to MVVM used by people I’ve personally talked to—folks in the data binding community, in our team here at Big Nerd Ranch, and from a great talk I heard at Droidcon NYC.
ConstraintLayout and Auto Layout use the same underlying algorithm. How do they differ?
Today’s the day—the schedule is clear, the agenda is set. It’s time to start work on a third edition of the Android book.
With the advent of multi-window in Android Nougat, you need to more carefully consider what your UI should be doing when your activity is visible vs. in the foreground. This post will highlight considerations to make in updating your UI on Nougat (and beyond) devices, while still providing a smooth experience for pre-Nougat users.
In this video, Paul Turner expands on his post on Doze Mode in Android Nougat and walks you through how to test Doze Mode on your devices.
In a previous post, we talked about background schedulers in Android, briefly mentioning the effects of Doze Mode in Android Marshmallow. This post will cover Doze Mode in more detail, the changes that are coming with Android Nougat and what you can do to correctly adapt to Doze Mode.
Another Google I/O keynote has come and gone, and we’ve been given a peek into many of the new products and technologies Google will be focusing on for the next year. If I had to give this year a theme, it would be a focus of joining and evolving existing technologies into new products and features.
Let’s take a look at the different methods for scheduling tasks in Android and discuss the pros and cons of each so that you can determine when to use each tool before implementing an inappropriate one.
In this post, I’d like to dive into Data Binding with fresh eyes. I’ll explain how Data Binding works at development time and at build time, which should clarify some of the rough edges in the current pre-release version. By the end, I hope to get you to where you can make an informed decision as to whether you want to use Data Binding, as well as how much of it you want to make use of.
The GCM Network Manager simplifies common networking patterns like waiting for network connectivity, network retries and backoff. Essentially, the GCM Network Manager allows developers to focus a little less on networking issues and more on the actual app, by providing a straightforward API for scheduling network requests.
Matt Compton recently described how to create custom Lint detectors for Android. While this is a great way to enforce your team’s code design patterns, it can be a big undertaking. The best way to enforce our custom Lint checks (and built-in checks, too) is to run Lint as part of your continuous integration build process.
MapView! You can see a
GoogleMap inside of it! Find your location! Pan! Zoom! Unzoom! There are too many amazing features to talk about. We should add one to our app like… now.
Google has graciously provided us with a
MapFragment that can easily be added to any Activity, but what if you don’t want a full
Fragment, or want to add a
MapView to a
At Google I/O 2014, Google unveiled
RecyclerView, a successor to
RecyclerView sought to strip away much of the cruft that slowed down
ListView, and in doing so, shipped without some of the conveniences we’d gotten used to. We’ve discussed how to responsibly add some of that functionality back in previous blog posts, and today we’ll continue with a look at list dividers.
It’s easy to get comfortable with boilerplate setup code, so much so that we gloss over the finer details. I’ve experienced this with LayoutInflater (which coverts an XML layout file into corresponding ViewGroups and Widgets) and the way it inflates Views inside Fragment’s onCreateView() method. Upon looking for clarification in Google documentation and discussion on the rest of the web, I noticed that many others were not only unsure of the specifics of LayoutInflater’s
inflate() method, but were completely misusing it.
Lint is a static analysis tool that can help identify bugs and problems in a software project. While it’s been around for many years, Lint has remained a timeless tool that’s been ported to a multitude of different platforms. There is great power in the Android Lint API, as you can create your own custom Lint rules. This post will go through an example of building a custom Lint check that identifies when an Enum is being used.
When the design support library dropped a few months ago, Android developers were given all kinds of goodies. But there is something mysterious lurking in the design support library. Something that has its tentacles throughout the library. This mysterious thing is the
There are good reasons people like event buses. Why have people come to hate them?
Our first Android roadshow is bringing one-day classes to various cities.
Direct Share can save the user a bit of time and make sharing content more streamlined. But how do we actually add Direct Share to an existing Android app?
As the Android community grows, so does the vast offering of available third-party libraries. Utilizing them allows developers to quickly and easily expand the capabilities of an app. We love it, users love it, until suddenly: the mysterious compile error.
Splash screens just exist to waste your time, right? I have to stare at some picture for three seconds until I can use the app. And I have to do this every time it’s launched. I know which app I opened. I know what it does. Just let me use it!
The Expandable RecyclerView library is a lightweight library that simplifies the inclusion of expandable dropdown rows in your RecyclerView.
Every once in a while, an Android developer might want to use a ViewPager without the added complexity of also using Fragments. A good example is an image gallery, where the user can swipe between different pictures. On these types of pages, all you really want to display is a view of static content (in this case an image), so I’m going to walk you through how to utilize the ViewPager with just plain-old Views and layouts.
It’s over! Brian, Kristin, Chris and I are finally done working on the second edition of Android Programming: The Big Nerd Ranch Guide, Second Edition.
Looking back on it, though, it’s all a blur. We spent months working on it! We must have been up to something.
In a previous post, I discussed integrating Android Studio, Gradle and Robolectric to perform unit testing as part of Android development. Some inquisitive commenters wanted to know if this setup supported testing multiple product flavors. The answer is the same as with most Robolectric-related topics: Yes, but…
If you’ve ever written an Android application, then you’ve likely used a third-party library in the process. The library may even have been open-source, so that the community can view, copy and modify the code. However, the creators always retain certain rights over their project, and the form in which the authors express these rights is called a software license.
Code completion can improve your productivity by reducing how much you have to type, but there are situations when a more powerful tool is needed. Thanks to Android Studio and IntelliJ, live templates make it much easier to focus on just the things you care about.
Last year, Google announced Material Design, a set of guidelines for Android apps and apps on other platforms. One example of such new goodies was the Floating Action Button, which requires a bit of setup. What’s more, some of its features work only on Lollipop and later. Enter the design support library, announced at this year’s I/O.
One of my favorite things to do during Google I/O is to think about the possibilities. While we’re looking forward to the new features coming in Android M and the new developer tools in Android Studio, we’re really geeking out over the big ideas that are way down the road.
I wasn’t really sure what design revelations to expect at Google I/O last week. Google released major Material changes last year, and I didn’t think sweeping changes would happen again so soon. While they didn’t talk about many visual design changes, they did introduce more guidance around designing apps, better legacy support for Material design and more compact design components for the Android SDK. The changes introduced this year seem to make implementing better design easier.
Animations add vivacity and personality to your apps. Let’s take a look at how to implement a subcategory of animations called “Frame Animations.”
What do designers, who may have little to no experience with mobile design, want and expect out of courses? Do web designers or graphic designers see the value of an extended, in-depth course like we offer at Big Nerd Ranch?
Get ready to tap into your creativity alongside the Nerds. Designers, developers and project managers: join us for our new Android Mobile Design and iOS Mobile Design bootcamps. In two days, these classes will teach you to design intuitive interfaces employing platform-specific conventions and innovative trends. You will learn vocabulary, current trends and how to work alongside developers to create a pixel-perfect app for mobile devices.
I’m calling it. We’ve been monitoring the state of testing in the Android world for some time now, waiting for the day when testing would be fully baked into the Android development cycle. Well, that day has finally arrived.
Learn ALL the things! That’s basically the motto at Big Nerd Ranch. And in my last post, I wrote about how my team, The Artists Formally Known As (╯°□°)╯︵ ɥsɐןɔ, learned a lot of new things when we tackled hardware hacking with Arduino, NeoPixels and Artoo.
We recently had our annual app-building competition, Clash of the Coders. It’s a fantastic opportunity for us nerds to experiment with unfamiliar technologies, stretching ourselves and our tools. It’s all about learning, a fundamental value of Big Nerd Ranch. After an intense 72-hour coding marathon, our team (The Artists Formally Known As (╯°□°)╯︵ ɥsɐןɔ, yep) came out with an online, multiplayer game equipped with clients crossing four platforms: iOS, Android, Web… and Arduino!
Quite a few continuous integration tools exist, but as soon as you narrow it down to options that properly support Android, it becomes much easier to pick one. Travis and TeamCity are viable options if you care primarily about the codebase compiling and passing tests, but do not need options for storing artifacts, signing them and publishing them. At Big Nerd Ranch, we have adopted Jenkins as our Android continuous delivery environment because it has enough extensibility for plugins to fully implement the entire deployment pipeline properly.
In our Android bootcamp, we teach that using Fragments is the right way to go (especially for beginners), and we also use Fragments extensively in all of our consulting projects. I decided to investigate Flow and Mortar, two libraries that were introduced with the goal of ridding the Android world of Fragments forever. Here’s what I found.
Functional Reactive Programming (FRP) offers a fresh perspective on solving modern programming problems. Once understood, it can greatly simplify your project, especially when it comes to code dealing with asynchronous events with nested callbacks, complex list filtering/transformation or timing concerns.
Editor’s Note:n This post has been updated since its initial release. The
generate(Bitmap, PaletteAsyncListener) methods have been deprecated in favor
of a builder static method on the
Palette class. The code listings in this
post now use the new
In May of 2014, we made the switch to Android Studio as our preferred Android IDE, migrating away from Eclipse in our Android bootcamps and book. As we have started new app development projects for clients, we transitioned away from IntelliJ, our previous IDE of choice. This shift has allowed us to build a uniform skillset, enhancing both our teaching and consulting. However, we still had trouble integrating some of the tools and techniques that made our past projects so successful. Android Studio recently moved out of beta, so now is a good time to share about our successes so far. We’ve put together a set of best practices for setting up a project that uses Android Studio, Gradle and Robolectric.
Let’s take another look at choice modes in Android Lollipop’s RecyclerView.
For a designer, the word “port” can be cringe-inducing. By definition, a port is an application adapted from one environment to another. However, what sounds like a short re-skinning project is actually a challenging process involving design, development and stakeholder communication.
One of the great ideas formalized in the new Material Design user interface guidelines is the Swipe to Refresh UI pattern. In fact, you’ve probably already seen and used it. It’s found its way into many popular Android apps like Facebook, Google Newsstand, Trello, Gmail and many others.
Android Lollipop’s RecyclerView makes animating items into and out of a list of content much easier. Getting RecyclerView to cleanly transition into a multiple choice caused some interesting problems, however. Here’s how to deal with them.
Looking for a way to further polish your Android app on Lollipop? One option a lot of developers overlook is the Overview Screen.
Lollipop, as we’ve mentioned before, is the largest update to Android in years. Material, Google’s new design language, is at the forefront of those changes.
As Android Studio moves closer to release, more and more projects are being moved over to this new IDE. One major stumbling block people often run into is Android Studio integration with Gradle. In this blog post, I hope to shed some light on what Gradle is, what it can do for you and some ways you can use it with your applications.
Android 5.0 Lollipop arrived last Thursday, with much hoopla. Unquestionably, Lollipop is the most significant Android release since Android 3.0 Honeycomb over three and a half years ago. Here’s what we’re looking forward to.
Note: At the 2015 Google I/O, Android announced their new Design Support Library, which includes the Floating Action Button. You no longer need to create it from scratch. Read my post on Android’s Design Support Library for more information.
Venture into the World of Wearables at our Android Wear Hack Night on Monday, July 21.
Sitting in the Google I/O keynote yesterday, one thing became apparent to me: Android is everywhere. I was well aware that Android is used all over the world, but Android will very soon not just be on many people’s phones in many diverse locations, but on many devices that a single person interacts with on a daily basis.
The Android Open Source Project has recently seen commit activity indicating that the Android Runtime (ART), included in KitKat, is going to very soon replace Dalvik, which has been executing your apps since the beginning of Android. If everything goes according to plan, users will not notice a thing. Developers shouldn’t have to do anything at all if they only use the Android SDK, and make minor updates if they use the NDK improperly.
Wearables are becoming ubiquitous. Every day, it feels like there’s some new fitness tracker with a slightly different set of sensors and an entirely new app/API/website/life-changing-experience/yet-another-account-to-set-up. And fitness trackers are only the most popular bastion of wearable computing. Once you start counting the many devices that used to be released as a USB peripheral and are now being updated to use Bluetooth Low Energy and a rechargeable battery, the list of wearables becomes even larger than the number of Android devices available.
Every Android programmer will at some point customize a ListView row by creating their own layout and populating it with data. When that happens, you’ll probably reach for the Holder pattern. But the Holder pattern is clumsy and full of boilerplate, and we can do better. In this post, we explore an alternative that uses a subclass of RelativeLayout to encapsulate the customization work.
I recently attended a Google Glass Design Sprint hosted by the Glass team. I’ve been working on various Glassware since July, but this was the first formal design process I’ve gone through. I learned a few things by putting myself in the mind of a designer.
What drives me as an instructor is my desire to connect with my students. To know what they want to learn and why they want to learn it. To understand what they already know and figure out how we can use that as the foundation for something more. As a teacher, I want to meet people where they are with the material, figure out where they want to go, and help them find a path.
In the previous post, we took a first look at the
[android.transition](http://developer.android.com/reference/android/transition/package-summary.html) framework and started following the evolution of our AndroidTransitionExample project. In this post, we’ll continue our exploration by learning how to control transitions and how to load them from XML files.
With KitKat, Google brought a number of welcome additions to Android. Today, we’ll focus on one of them, the android.transition framework.
A while back, MarkD wrote a great series of posts on DTrace. I’d never been exposed to DTrace—I assumed it was similar to strace. It’s a whole other animal, though—an event-based engine suitable for everything from debugging to systems scripting.
Should you use Volley or Picasso to load images in your app? We weigh image downloading components in Android app development.
Android developers spend a lot of time developing tablet versions of their applications.
Have you ever sat through a three-hour presentation? Has anyone ever even asked you to?
As a Rails developer, I learned the benefits of a test-driven style, and I never want to go back to the old style of writing code that might work, but might not! So when I decided to learn Android programming, finding the right strategies and tools to drive tests was the first task at hand. I found several excellent libraries that help facilitate a test-driven workflow on Android, and a test culture that is rapidly adopting the use of automated testing.