Android Architecture Components version 1.0.0 has now been released, this means their API’s are now stable and you should be more comfortable with adopting it in your projects.
What are Android Architecture Components?
Android Architecture components (AAC) are a set of Android libraries that help you structure your application in a way that is robust, testable, and maintainable.
In this post, we are going to discuss how to structure an Android Application’s code for realtime updates using Android Architecture Components. We will be talking specifically about using
LiveData to build an Android application that will be updating in realtime.
Javalin is a very lightweight web framework for Kotlin and Java, inspired by Sparkjava and koa.js. Javalin is written in Kotlin with a few functional interfaces written in Java. This was necessary to provide an enjoyable and near identical experience for both Kotlin and Java developers.
Javalin is really more library than framework; you don’t need to extend or implement anything and there are very few “Javalin-concepts” you have to learn.
REST API Simplicity
Javalin started as a fork of the Spark Java and Kotlin web framework but quickly turned into a ground-up rewrite influenced by koa.js. All of these web frameworks are inspired by the modern micro web framework grandfather: Sinatra, so if you’re coming from Ruby then Javalin shouldn’t feel too unfamiliar.
Javalin is not aiming to be a full web framework, but rather just a lightweight REST API library. There is no concept of MVC, but there is support for template engines, websockets, and static file serving for convenience. This allows you to use Javalin for both creating your RESTful API backend, as well as serving an
index.html with static resources (in case you’re creating an SPA). This is practical if you don’t want to deploy to apache or nginx in addition to your Javalin service. If you wish to use Javalin to create web-pages instead of just REST APIs, there are some simple template engine wrappers available for a quick and easy setup.
If you want a more established Java web framework, you could try Spark. If you want a more established Kotlin web framework, you can try the Spark Kotlin Wrapper.
It is a common problem in Android development when your API is not sending you exactly the same data, what you want to show in your views, so you need to implement more complex requests. Possibly your app needs to make multiple requests, that wait for each other, or call multiple requests after the previous one finished. Sometimes you even need to combine these two approaches. This can be challenging in plain Java and will often result in unreadable code, what is also painful to test.
Today I’m going to show you in a simple example how this can be achieved in a clean way using RxJava. The example is written in Kotlin, what makes the code more concise and easy to read. If you are completely new to RxJava or Kotlin, I suggest you catch up on the basics. There are some great resources here as well.
When most people hear “Java” they think of Java the programming language. Java is a lot more than a programming language, it also implies a larger ecosystem including the Java Virtual Machine (JVM). Java, the programming language, is just one of the many languages that can be compiled to run on the JVM. Some of the most popular JVM languages, other than Java, are Clojure, Groovy, Scala, Kotlin, JRuby, and Jython (see this link for a list of more JVM languages).
Did you know that you can compile and subsequently run all these languages on AWS Lambda?
AWS Lambda supports the Java 8 runtime, but this does not mean you are limited to the Java language. The Java 8 runtime is capable of running JVM languages such as Kotlin and Groovy once they have been compiled and packaged as a “fat” JAR (a JAR file containing all necessary dependencies and classes bundled in).
In this blog post we’ll work through building AWS Lambda functions in both Kotlin and Groovy programming languages. To compile and package our projects we will use Gradle build tool.
To follow along, please clone the Git repository available at GitHub here. Also, I recommend using an Integrated Development Environment (IDE) such as JetBrain’s IntelliJ IDEA, this is the IDE I used while working on these projects.
Google announced Kotlin as an official language for Android development. Some famous developer companies, like square, started using kotlin as their production language long before the official announcement was made.
Now one of the most trending questions juggling around the minds of many experts and most beginners is should I learn kotlin or stick to java? Here’s some point should be made based on three stages of a developers like really really beginner, ninja apprentice, totally ninja.
Google has already expressed several times that they don’t have anything against Kotlin, and that they’re not preventing us from using it while the compiler still generates valid bytecode.
But many people is still waiting for an official support, something that could never happen.
While we wait until that moment though, I thought it would be nice to know what the Google Developers Experts for Android think about it.
If you hadn’t heard about it, Google Developers Experts (GDEs) is a program that recognizes outstanding developers the effort to be a reference on the field they are involved in.
I contacted some of these Android Experts (the list is huge!), and I got answers from 17 of them. Thanks a lot for being so nice and taking your time to answer!
I’ve just asked them to tell us a bit about them, and what they think about Kotlin. The answers are obviously unmodified, so you will find voices for and against (or not so for) the language.
I really hope this helps you form an idea of how Kotlin is being a game changer, and that, at least, is a language to take into account if you are an Android developer.
Without further delay, here it is the opinion of our GDEs in no particular order:…
Our vision for Kotlin is to enable the use of a single expressive, performant, strongly typed language across all components of a modern application. Kotlin 1.1 makes two major steps towards this goal.
Second, we’re introducing support for coroutines. As a lightweight alternative to threads, coroutines enable much more scalable application backends, supporting massive workloads on a single JVM instance. In addition to that, coroutines are a very expressive tool for implementing asynchronous behavior, which is important for building responsive user interfaces on all platforms.
Below we describe these two changes further. In other news: we’ve added type aliases, bound callable references, destructuring in lambdas and more. See the details in our What’s new page (check out the runnable examples!).
There’s no sense in re-inventing the wheel when you’re working on Android apps, especially if you’re just starting out. In this 360AnDev talk, we will cover a range of libraries you can include in your Android apps that will help you tackle the problems other people have already solved. Whether you’re loading data from a web API, showing & caching images, or storing & syncing data, there’s a library you can pull in to help you out!
Kotlin may seem like a new kid on the block – itʼs been officially released only in February. Its history however dates a few years back and itʼs mature and stable enough to be used for developing solid reliable applications. Therefore at Allegro we decided to give it a chance – we built our new shiny server-side system using Kotlin as its primary language and we do not regret it.
One of the first features a Kotlin developer learns is the languageʼs approach to handling
null values. It is quite interesting – especially at times like these when the most popular way of handling this problem is to use some kind of Option monad. As weʼll soon see Kotlin actually does not introduce any new special wrapper type – it uses regular Java types albeit with slight variance.