The Jack and Jill compiler chain allows you to use Java 8 syntax such as lambda expression and method references in your code. In Android Studio 2.2.1, new applications don't have the Jack compiler turned on automatically - you have to configure the project in the Gradle build file. Once you'd done this you can abbreviate a lot of common code such as method handlers. But you'll lose one of Android Studio's useful features, Instant Run, since as of this release the Jack compiler and Instant Run aren't compatible with each other.
- [Instructor] In Android Studio 2.2,…you can use the new Jack compiler…that's part of a tool chain known as Jack and Jill.…When you configure a project to use the Jack compiler,…you can then use Java Eight syntax,…including lambda expressions, method references, and more.…I'll demonstrate how to configure…the Jack compiler in this project.…In this project, I have a floating action button.…Let's start from where…the floating action button is declared.…I'll control or command click…into the id of the resource, R.id.fab.…
The floating action button is declared…in the file, activity_main.xml,…and this is where its id is declared.…In the main activity, in the onCreate method,…I'm getting a reference to that button object,…and I'm using a method…of this activity class named findViewById.…Now, this is a very important method in Android.…It's how you get references to objects…that are declared in layout files.…Find view by id always returns a view, but typically,…you'll want to explicitly cast the returned object…as the type of object you know you're working with,…
- Installing Android Studio
- Creating your first Android Studio project
- Managing profile files, including Gradle scripts and support libraries
- Defining screens with activities
- Implementing designs in XML layouts