Posts

Showing posts from April, 2017

Kotlin: Do more with less code

Image
Java is the most widely used language for Android development, but that doesn’t mean it is always the best choice.The biggest problem with Java is that it is old , verbose , not a “ modern language ” and don’t forget the infamous NullPointerException . Java 8 , bringing some modern flavors to the language but Android certainly doesn’t use all the features of Java 8 and we are still stuck in the old Java 7 and 6.That's where Kotlin comes in: This relatively new open source language, based on the Java Virtual Machine (JVM), is gaining traction with Android software engineers. What is Kotlin? Kotlin is a statically-typed programming language(sometimes referred to as Swift for Android) that runs on the JVM, developed by the JetBrains team , and is now in its 1.1 version. What makes it useful in Android development is that it compiles to JVM bytecode. It is fully compatible with Java, and Kotlin code can be simply converted to Java code and vice versa (there is a plugin

Introduction to Spring Animation

Image
When writing an application, it's important to consider exactly what your graphical demands will be. Varying graphical tasks are best accomplished with varying techniques. Android provides a variety of powerful APIs for applying animation to UI elements and drawing custom 2D and 3D graphics. Dynamic-animation is a new module introduced in revision 25.3.0 of the Android Support Library . It provides a small set of classes for making realistic Physics-based Animations . What is Physics-based Animation Physics-based animation uses the fundamentals of physics to build animations. An animation is driven by force. The animation comes to rest when the force reaches equilibrium. The new set of animation APIs embeds physics to render a more natural-looking and flexible animation. Spring Animation Spring Animation is one of the animation API provided by the Dynamic-animation module. Physics-based animations are driven by force. Spring force, is one such force that guides in

Android Debug Database: A Library for Debugging Android Databases and Shared Preferences

Image
Android comes with a powerful built-in database called SQLite , but it doesn't come with the best set of debugging tools. When it comes to debugging databases in an android application, it is very difficult to see what’s happening inside the database. The same is true with Shared Preferences . In fact, unless you have a rooted device, you can't even get the SQLite tables off your device without jumping through some hoops. Android Debug Database Android Debug Database is a powerful library for debugging SQLite databases and Shared Preferences in Android applications. It allows you to view databases and shared preferences directly in your browser in a very simple way. By using the Android Debug Database we can do the following: See all the databases. See all the data in the shared preferences used in your application. Run any sql query on the given database to update and delete your data. Directly edit the database values. Directly edit shared prefer

Exploring Android O: Autosizing TextViews

Image
With the release of first developer preview of Android O, Google come with a solution to auto-size text in a TextView similar to the way the iOS SDK allows to select “ fit text to box ”. Let’s take a look at this exciting new feature and how we can implement it into our Android applications! Autosizing TextViews Android O allows to instruct a TextView to let the size of the text expand or contract automatically to fill its layout based on the TextView's characteristics and boundaries. This setting makes it easier to optimize the text size on different screens with dynamic content. Creating New Project We’ll start by creating new project in Android Studio and do the basic setup required.Create a new project in Android Studio from File > New Project and fill the project details. While creating the project, select the API O: Android 7+(O preview) as Minimum SDK. Update Build Configuration Open build.gradle located under app module and Update compileSdk