122 Posted Topics
## Introduction ## In Android development, UseCases are classes that encapsulate business logic that are often used in ViewModel classes. UseCases belong to the optional Domain layer in Android apps, so they are not required, but can reduce your ViewModel’s complexity and make your application easier to test. In this … | |
## Introduction ## When working with WorkManager, it is important to know how to provide input data to your Workers. In this tutorial, we will learn how to provide basic input data to a Worker as well as when Workers are chained together. ## Goals ## At the end of … | |
## Introduction ## If your App only need a simple way to play videos on Android, then **VideoView** (`android.widget.VideoView`) might just fit the bill. In this tutorial, we will learn how to use VideoView for video playback in our App. ## Goals ## At the end of the tutorial, you … | |
## Introduction ## Android provides many ways to perform background tasks, such as Services, WorkManager, or even threads. In this tutorial, we will learn how to create a Service for our Android app. ## Goals ## At the end of the tutorial, you would have learned: 1. How to create … | |
## Introduction ## When using a Worker (**from the WorkManager library**), you might have wondered how to inject dependencies with Hilt. In this tutorial, we will learn how to inject dependencies into our Worker. ## Goals ## At the end of the tutorial, you would have learned: 1. How to … | |
## Introduction ## Finding a View in Espresso tests can be quite confusing because there are so many matchers available. In this tutorial, we will learn how to find a View based on its sibling contents. ## Goals ## At the end of the tutorial, you would have learned: 1. … | |
## Introduction ## When working with Room, you might have wondered how to run multiple statements in a single transaction. Running multiple statements in one transaction has two main benefits: 1. Your statements can reuse the same connection. 2. They can all fail together if something goes wrong. Regarding the … | |
## Introduction ## When working with Room, you might have wondered how to describe one-to-many relationships between entities. In this tutorial, we will learn how to do just that. ## Goals ## At the end of the tutorial, you would have learned: 1. How to define one-to-many relationship for entities … | |
## Introduction ## There are many ways to describe relationships between Entities in Room, one of which is to embed an entity inside of another. When embedding an Entity, the columns of the embedded Entity are extracted as member columns of the enclosing entity. In this tutorial, we will learn … | |
## Introduction ## When working with Services on Android, you might have ran into an issue where you would like to: 1. Use a concrete implementation of a Service (*from a built-in or third party library*). 2. Make the Service lifecycle-aware so that you can use coroutines with it. Many … | |
## Introduction ## When working with Room, there might come a situation during bulk CRUD operations that it would be useful to add a Foreign Key to one of our tables. This provides two main benefits: cascading delete (*must be configured manually*) and enforcing data integrity on linked entities. In … | |
## Introduction ## If your Android Application uses Room, then you might have wondered how to prepopulate a Room database. In this tutorial, we will learn how to prepopulate a Room database. ## Goals ## At the end of the tutorial, you would have learned: 1. How to prepopulate a … | |
## Introduction ## When working with music files, you might have wondered how to load display art from Audio files. In this tutorial, we will learn how to load thumbnails for audio files. ## Goals ## At the end of the tutorial, you would have learned: 1. How to load … | |
Re: Hello EmiLynn, here are a couple of hints for you. 1. Your teacher's instruction says to return `a map of the name of each mammal and the sum of the ages`, so you need to return `Map<String, Int>` instead of `Map<String, Mammal>`. This will allow the compiler to help you … | |
## Introduction ## When working with Hilt, you might have wondered how to inject ViewModels into your application. In this tutorial, we will learn how to inject ViewModels into your app Fragments. ## Goals ## At the end of the tutorial, you would have learned: 1. How to inject ViewModels … | |
## Introduction ## In Android development, reusable layouts can be used to reduce duplicate code across XML files. In this tutorial, we will learn how to reuse layout files, especially with View Binding enabled. ## Goals ## At the end of the tutorial, you would have learned: 1. How to … | |
## Introduction ## MediaPlayer (`android.media.MediaPlayer`) is a popular way to play media files, and combining it with a SeekBar can greatly improve the user experience. In this tutorial, we will learn how to synchronize a MediaPlayer progress to a SeekBar position. ## Goals ## At the end of the tutorial, … | |
## Introduction ## When working with a Room database, we are mostly restricted to save data using primitives (*and boxed primitives*). Reference types are not supported right out of the box, but can be enabled by creating additional [TypeConverter](https://developer.android.com/reference/androidx/room/TypeConverter). If you are familiar with ORM-light frameworks such as Spring JDBC, … | |
## Introduction ## In this tutorial, we will learn how to add swipe-to-remove and drag-to-reorder functionalities into RecyclerView. ## Goals ## At the end of the tutorial, you would have learned: 1. How to add swipe-to-remove and drag-to-reorder functionality to a RecyclerView. ## Tools Required ## 1. Android Studio. The … | |
## Introduction ## When using Navigation Components, you might have wondered how to pass arguments between destinations. We will learn how to do just that in this tutorial. This tutorial also builds upon the [Basic Navigation](https://www.daniweb.com/programming/mobile-development/tutorials/536923/android-native-how-to-use-navigation-component#post2282945) tutorial, so if you are not familiar with Navigation Components, I would recommend you … | |
## Introduction ## If you are working on a native Android app using the View system, then you might have come across a situation where you would need to add a Composable (`androidx.compose.runtime.Composable`) into your View hierarchy. In this tutorial, we will learn how to add a Composable into an … | |
## Introduction ## When working on Android with Kotlin, you might have ran into property delegates on a few occasions, such as `activityViewModels()` from `androidx.fragment.app` or `remember()` from `androidx.compose.runtime`. In this tutorial, we will learn what property delegates are and how to create them ourselves. ## Goals ## At the … | |
## Introduction ## Among all of the animation API’s on Android, MotionLayout is one of the best classes to use to create complex animations. It can animate property and motion of multiple views at the same time. Other benefits include declarative style XML and the intuitive **Motion Editor** built right … | |
## Introduction ## If you are working with the latest Material 3 libraries on Android, you might have wondered how to use the **Bottom Navigation Bar** in your App. In this tutorial, we will learn how to use the Material 3 Bottom Navigation Bar (BNB). ## Goals ## At the … | |
## Introduction ## Proto DataStore is a great way to store the **permanent** state of your application, especially if you prefer type safety. In this tutorial, we will learn how to store our App state using the Proto DataStore. ## Goals ## At the end of the tutorial, you would … | |
## Introduction ## The **Storage Access Framework** (SAF) provides a great way to access files exposed by other applications via their own DocumentProviders. In this tutorial, we will learn how to use the SAF in our App. ## Goals ## At the end of the tutorial, you would have learned: … | |
## Introduction ## In Android development, the MediaStore API is a great API to use if you are building a music player. In this tutorial, we will learn how to query for audio files in the MediaStore database. ## Goals ## At the end of the tutorial, you would have … | |
## Introduction ## The release of Android 12 also came together with Material 3. Whether you love it or hate it, it is likely to be here to stay for a couple of years, therefore, it would be useful to know how to use it. In this tutorial, we will … | |
## Introduction ## WorkManager is the preferred method of managing background tasks on Android. It also includes convenient extensions for RxJava3 and Kotlin Coroutines. In this tutorial, we will learn how to use WorkManager as well as how to observe the background task with the debugging tool Background Task Inspector. … | |
## Introduction ## Coil is a popular image loading library for Kotlin-first Android projects. It is lightweight, fast and is super easy to use. In this tutorial, we will learn how to use Coil to load images into our project. ## Goals ## At the end of the tutorial, you … | |
## Introduction ## In this tutorial, we will learn how to capture a picture with the new **ActivityResult** APIs(`androidx.activity.result`), which replace the `startActivityForResult()` and `onActivityResult()` APIs(*from Activity class*). Additionally, we will also learn about the ContentProvider **FileProvider**, which we will have to set up to save our images. ## Goal … | |
## Introduction ## Navigation component is an abstraction on top of FragmentManager, which simplifies navigation between fragments. In this tutorial, we will learn how to use the Navigation component in our App. ## Goal ## At the end of the tutorial, you would have learned: 1. How to use the … | |
## Introduction ## Based on the latest report from Appbrain, Samsung has the highest market share(*>35%*) among all of the Android OEMs, therefore it is important that your apps are tested against Samsung phones. In this tutorial, we will learn how to load Samsung Emulator skins onto our emulator devices. … | |
## Introduction ## Regardless of whether you like notches on your devices or not, they exist, so as developers, we will have to adapt our Apps to work with them. In this tutorial, we will learn how to adapt our code to work with notches. The device used in this … | |
## Introduction ## In Android development, Espresso can be combined with Junit to create powerful UI automation tests. In this tutorial, we will learn how to create Espresso tests. ## Goals ## At the end of the tutorial, you would have learned: 1. How to create Espresso tests. ## Tools … | |
## Introduction ## UI Automator is a library that allows you to create tests that can interact with other components besides your App, such as Settings or other Android components. In this tutorial, we will learn how to incorporate UI Automator into our tests. ## Goals ## At the end … | |
## Introduction ## In Android development, Intents are used to request an action from an app component. There are two types of Intents: explicit and implicit. Explicit Intents are used when you know the exact package name of the component you need started. Implicit Intents, however, do not need a … | |
## Introduction ## Snackbars are great for displaying brief messages providing feedback to your users. In this tutorial, we will learn how to create Snackbars. ## Goals ## At the end of the tutorial, you would have learned: 1. How to create a Snackbar. ## Tools Required ## 1. Android … | |
## Introduction ## Notification is a great way to display information outside of your Android application. Your end users most likely already interact with notifications everyday, so knowing how to create notifications can greatly boost your user experience (*but can also backfire if used incorrectly*). In this tutorial, we will … | |
## Introduction ## Starting on API level 25, static Shortcuts can be used to quickly navigate to a specific point in your app. In this tutorial, we will learn how to create static shortcuts for an Android app. ## Goals ## At the end of the tutorial, you would have … | |
## Introduction ## With OLED screens becoming more and more common on smartphones, adapting a dark theme to your app can provide a boost to battery life. In this tutorial, we will learn how to add a dark theme to your native Android app. ## Goals ## At the end … | |
## Introduction ## All TextView objects have a special attribute called `textAppearance`. This attribute can be used to set the style for text content in a TextView without affecting other styling attributes on the same TextView object. In this tutorial, we will learn how to apply `textAppearance` to TextView objects. … | |
## Introduction ## Complex Views can use up RAM and reduce the performance of your Android apps. If a View is rarely used, you should consider delaying its rendering until it is needed by your app. One way to do that is to use the ViewStub View. ViewStub is very … | |
## Introduction ## If your Android app is available to a global audience, you might have wondered how to load localized **String**s into your app. This tutorial will teach you how to do just that. There are quite a few steps involved, but once you understand the concepts, it will … | |
## Introduction ## One of the best debugging tools in Android Studio is the *live database inspector*. It allows developers to peek at the current state of the database and even run queries against it. In this tutorial, we will learn how to use it to debug a local SQLite … | |
## Introduction ## When localizing your application, `ResourceBundle` can be a great way to load Strings from different locales. The only concrete implementation of ResourceBundle is `PropertyResourceBundle`, which allows us to load static Strings from a text file. Because `.properties` is a common file extension used for ResourceBundles, creating ResourceBundle … | |
## Introduction ## Junit is a popular framework to create tests for Java applications. Although individual unit tests are mostly straightforward, integration and functional tests are a little bit more involved because they usually require multiple components working together. For that reason, understanding the life cycle of Junit tests can … | |
## Introduction ## When collecting a stream, the `groupingBy()` Collector(`java.util.stream.Collector`) can be used to put data into different groups based on specified conditions. `groupingBy()` is a little bit more complicated to use than [partitioningBy()](https://www.daniweb.com/posts/jump/2280662) because the key can be of any type, whereas with `partitioningBy()`, the keys must be of … | |
## Introduction ## Whenever we want to modify numbers from multiple threads running concurrently, such as modifying a counter, one of the best options is to use the AtomicX classes. The most basic numeric atomic classes are AtomicInteger and AtomicLong. In this tutorial, we will learn how to use the … | |
## Introduction ## If you are a Java developer coming to Kotlin, you might have wondered how to use a language construct that is similar to the try-with-resource statement in Java to automatically close Autocloseable/Closeable resources for you. Luckily, Kotlin provides the inline extension function `use()` that provides similar functionality … |
The End.