Image for post
Image for post
The picture is provided by Unsplash

Nowadays, Kotlin Coroutines introduce an advanced and efficient approach of concurrency design pattern, which can be used on Android to simplify asynchronous codes. Moreover, a suspending function asynchronously returns a single value, but the critical question is how can we return multiple asynchronously computed values? In Kotlin coroutines, a flow is a type that can be able to emit multiple values sequentially like receiving live updates from a database, as opposed to suspend functions that return just only a single value. This article aims to discuss the main concepts, entities, and async possibilities in Kotlin flow.

Introduction and Overview

As you know, multiple values can be represented in Kotlin by using collections. For instance, we can have a sample function, which returns a List of five numbers and print them all using forEach as…


Image for post
Image for post
The picture is provided by Unsplash

Basically, asynchronous programming can be considered as an indispensable issue in advanced Android apps because as an Android developer you have to manage expensive and heavy tasks away from UI thread. Nowadays, Kotlin Coroutines introduce an advanced and efficient approach of concurrency design pattern, which can be used on Android to simplify asynchronous codes. As a matter of fact, this approach is much more simple, comprehensive, and robust in comparison with other approaches in Android. This article aims to discuss some key concepts, functions, and classes of Kotlin Coroutines in Android development.

Introduction and Overview

Fundamentally, asynchronous programming is a means of parallel programming in which a unit of work runs separately from the main application thread and notifies the calling thread of its completion, failure or progress. Thus, This means you can be able to handle some tasks in the background without avoiding UI freezes and annoying user experiences. Android offers some traditional asynchronous programming solutions such as Thread and AsyncTask. However, the problem has not completely solved yet. In other words, AsyncTask and Thread can easily produce memory leaks and overheads, and the problem of Callback Hell is one of the main negative consequences in traditional programming as well. Moreover, although RxKotlin or RxJava is one of the efficient mechanism in Android for concurrency as well as asynchronous programming, it takes a lot of time to get to know and use it efficiently in practice by developers. So, Google has studied accurately some best practices and some feedback for concurrency recently that are used by Android developers. Eventually, the best solution should follow three main principles in Google’s view, and they believe that Kotlin Coroutines provides these ideas as…


Image for post
Image for post
The picture is provided by Unsplash

As a matter of fact, Kotlin is a general-purpose, statically typed, and open-source programming language. A recent study by Google represents that developers who adopt Kotlin are, on average, 50% more likely to be satisfied with their programming language. Besides, currently, more than 70% of the top 1000 apps in the Google Play store include Kotlin code. This article will discuss some critical concepts, features, and best practices in using Kotlin for building modern Android apps.

Introduction and Overview

Basically, Kotlin is a general-purpose, statically typed, and open-source programming language. It runs on Java Virtual Machine (JVM), and also it can be used to develop Android apps, server-side apps and much more. Kotlin was developed by JetBrains team. A project was started in 2010 to develop the language, and first released in February 2016 officially. Since the release of Android Studio 3.0 in October 2017, Kotlin has been included as an alternative approach to the standard Java compiler. A recent survey by Google represents that developers who adopt Kotlin are, on average, 50% more likely to be satisfied with their programming language. The same study illustrates that 60% of Android Pro developers are using Kotlin in their codebase. Also, now, more than 70% of the top 1000 apps in the Google Play store contain Kotlin code. Currently, over 60 of Google’s apps are using Kotlin. Google’s large internal codebase counts over two million lines of Kotlin code. Eventually, Google recently started using Kotlin for server-side code, too. …


Image for post
Image for post
The picture is provided by Unsplash

Basically, Android notification provides information for users, and it can be an effective way for communicating with them as well. Besides, Android notifications become visible to users in various locations and formats, such as an icon in the status bar, a more detailed entry in the notification drawer, a badge on the app’s icon, and on paired wearables in a self-directing way. This article aims to discuss some advanced features and best practices in using Android notification.

Introduction and Overview

A notification is a message, which you can be able to show to the user outside of your application’s normal UI. Notifications appear in the phone’s notification area, and then can be expanded to see more information. In general, this is used to keep the user informed about events that are coming in, such as new email messages, new chat messages, or even an upcoming calendar event. Notifications can consists of actions that let the user take a relevant action from within the notification drawer. …


Image for post
Image for post
The picture is provided by Unsplash

As a matter of fact, a fragment is a reusable class that implements a portion of an activity in Android development. Fragments can be able to provide modularity and reusability into your activity’s UI by allowing you to separate the UI into discrete pieces. Furthermore, Android Jetpack has been announced by Google recently as a set of libraries, tools, and guidance for modern Android development. This article will discuss some advanced features and improvements in using fragments, which have been designed by Google for Android developers.

Introduction and Overview

As we know, fragments were introduced in Android Honeycomb API level 11 as micro activities. Basically, a fragment is a reusable class, which implements a portion of an activity. A Fragment usually defines a part of a user interface. Fragments have to be embedded in activities; they cannot run independently of activities. Therefore, fragments can be able to provide modularity and reusability into your activity’s UI by allowing you to divide the UI into discrete pieces. Activities are an ideal place to put global elements around your app’s user interface like navigation drawer. In contrast, fragments are appropriate for handling the UI of a single screen or portion of a screen. For instance, assume an Android app that reacts to different screen sizes. On larger screens, the Android app should display a static navigation drawer and a list in a grid layout. On smaller screens, the app should show a bottom navigation bar and a list in a linear layout. So, the question would be what is the best approach in this case? By utilizing fragments, the activity is responsible for showing the correct navigation UI while the fragment displays the list with the appropriate layout. In short, separating your UI into fragments makes it easier to modify your activity’s appearance at runtime. When your Android activity is in the STARTED lifecycle state or higher, fragments could be added, replaced, or removed. In fact, you can be able to maintain a history of these changes in a back stack, which is handled by the activity. One of the significant point in utilizing fragments in practice is that you can use multiple instances of the same fragment class in the same activity, in multiple activities, or even as a child of another fragment. This means you should just only support a fragment with the necessary logic to handle its own UI. In other words, you should avoid depending on or manipulating one fragment from another. …


Image for post
Image for post
The picture is provided by Unsplash

As you know, a growing interest to Machine Learning forced the companies to focus and invest on it. Machine Learning (ML) is the major of computational science, which focuses on analyzing and interpreting patterns and structures in data to enable learning, reasoning, and decision making outside of human being interaction. Furthermore, Machine Learning is a programming approach that provides your Android apps the capability to learn and improve automatically from previous experience. As a result, Google has designed and implemented a number of advanced features and tools for Android Machine Learning. …


Image for post
Image for post
The picture is provided by Unsplash

Nowadays, Google has announced some new features for user engagement and business success such as Google Play Instant and Android App Bundle. Google Play Instant enables native Android apps and games to launch on devices running Android 5.0 or higher without being installed. Furthermore, with the introduction of the Android App Bundle, developers can be able to build smaller apps and smoother deployment process automatically. Another point is that the App Bundle format introduces Dynamic Features. Dynamic Features allow you to modularize specific features, and then deliver them to your users on-demand. …


Image for post
Image for post
The picture is provided by Unsplash

As a matter of fact, writing high-quality code for high-complexity Android applications needs considerable effort and experience. Even though an application should meet the customer’s requirements, it must be flexible, testable, and maintainable. To face some challenges and problems in software development, Clean Architecture has been represented. Clean Architecture is a software design philosophy that separates the elements of a design into ring levels. Nowadays, Google has announced Android Architecture Components that includes a new set of libraries. This can be useful for designing robust, testable, and maintainable Android apps by following Clean Architecture principles. …


Image for post
Image for post
The picture is provided by Unsplash

As a matter of fact, Android Studio is the official integrated development environment for Google’s Android Operating System (OS) that has been built on JetBrains’ IntelliJ IDEA. Nowadays, the stable version of Android Studio 4.1 has been released by Google, which addresses common editing, debugging and optimization use cases. This essay aims to discuss some new features of Android Studio 4.1 that are vital for developing modern apps.

Introduction and Overview

Basically, Android Studio is the official integrated development environment for Google’s Android Operating System (OS), built on JetBrains’ IntelliJ IDEA software. …


Image for post
Image for post
The picture is provided by Unsplash

As you know, testing your Android app plays a vital role in development process. After running tests on your app, you can be able to verify your app’s correctness, functional behavior, and usability before the releasing process. There are a number of tools and methods in Android testing. However, nowadays, Google has announced AndroidX Test, which brings some advanced features and capabilities into this way. This essay aims to discuss some main concepts and ideas in Android testing in recent years.

Introduction and Overview

As a matter of fact, testing your app is a key factor of the app development process. By running tests on your Android application effectively, you can be able to verify your Android app’s correctness, functional behavior, and usability before you want to release it officially. There some benefits can be mentioned for testing in this way. In other words, test provide fast feedback on failures. A bug caught early on in development is more low-priced to fix than after you developed your application. They give you a safety net for making changes to your code. You are free to re-factor, clean-up, and optimize safely in the knowledge, which you are not planning to break any of the existing functionality. In addition, a readable test provides the stable development velocity that helps you to minimize technical debt. …

About

Kayvan Kaseb

Senior Android Developer/Technical Writer/Researcher/Artist https://www.linkedin.com/in/kayvan-kaseb

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store