Category: Android Studio

  • An Android Studio SharedFlow Tutorial

    The previous chapter introduced Kotlin flows and explored how these can be used to return multiple sequential values from within coroutine-based asynchronous code. This tutorial will look at a more detailed flow implementation, this time using SharedFlow within a ViewModel. The tutorial will also demonstrate how to ensure that flow collection responds correctly to an…

  • Kotlin Flow Guide

    The earlier chapter, A Guide to Kotlin Coroutines taught us about Kotlin Coroutines and explained how they can perform multiple tasks concurrently without blocking the main thread. As we have seen, coroutine suspend functions are ideal for performing tasks that return a single result value. In this chapter, we will introduce Kotlin Flows and explore…

  • An Android Remote Bound Service Tutorial

    In this final chapter dedicated to Android services, an example application will be developed to demonstrate the use of a messenger and handler configuration to facilitate interaction between a client and remote bound service of a messenger and handler configuration to facilitate interaction between a client and a remote bound service. Client to Remote Service…

  • Android Local Bound Service Tutorial

    As outlined in the previous chapter, Bound services provide a mechanism for implementing communication between an Android service and one or more client components. This chapter builds on the overview of bound services provided in An Overview of Android Services before embarking on an example implementation of a local bound service. Understanding Bound Services Bound…

  • An Overview of Android Services

    The Android Service class is designed to allow applications to initiate and perform background tasks. Unlike broadcast receivers, which are intended to perform a task quickly and then exit, services are designed to perform tasks that take a long time to complete (such as downloading a file over an internet connection or streaming music to…

  • A Kotlin Coroutines Tutorial

    The previous chapter introduced the key concepts of performing asynchronous tasks within Android apps using Kotlin coroutines. This chapter will build on this knowledge to create an example app that launches thousands of coroutines at the touch of a button. Creating the Coroutine Example Application Select the New Project option from the welcome screen and,…

  • A Guide to Kotlin Coroutines

    When an Android application is first started, the runtime system creates a single thread in which all components will run by default. This thread is generally referred to as the main thread. The primary role of the main thread is to handle the user interface in terms of event handling and interaction with views in…

  • Android Broadcast Intents and Broadcast Receivers

    In addition to providing a mechanism for launching application activities, intents are also used to broadcast system-wide messages to other components on the system. This involves the implementation of Broadcast Intents and Broadcast Receivers, both of which are the topic of this chapter. An Overview of Broadcast Intents Broadcast intents are Intent objects that are…

  • An Android Implicit Intent Tutorial

    This chapter will create an example application in Android Studio designed to demonstrate a practical implementation of implicit intents. The goal will be to create and send an intent requesting that the content of a particular web page be loaded and displayed to the user. Since the example application itself will not contain an activity…

  • An Android Explicit Intents Tutorial

    The chapter entitled An Android Intents Overview covered the theory of using intents to launch activities. This chapter will put that theory into practice by creating an example application. The example Android Studio application project created in this chapter will demonstrate the use of an explicit intent to launch an activity, including the transfer of…