Android Studio includes multiple inspectors, such as the Layout Inspector and Database Inspector, to help you investigate and understand the internal state of your running app. With Android Studio Arctic Fox, we are releasing a new inspector to help you monitor and debug workers your app schedules using WorkManager 2.5.0 or higher.
WorkManager is the recommended way to run asynchronous tasks in the background, even after the app is closed. Although it’s easy to configure your tasks as WorkManager workers, once a worker is queued, its execution is difficult to monitor and tricky to debug if you face issues.
Here we are with the third article of second Navigation series. If you prefer to watch this content instead of reading, check out the video below:
In the previous articles in this series, we added coffee tracker functionality, enhanced the user experience with navigation UI and implemented conditional navigation.
This time we’ll see how to organize the navigation graph by using nested graphs and using the include tag to import other graphs. This will allow us to modularize the app and see how navigation works with modules. …
This is the second article in of this Navigation series. If you prefer to watch this content instead of reading, check out the video below:
In the previous article, I used
NavigationUI, implemented bottom navigation in the app and also added a
SelectionFragment to enable or disable coffee tracking. However, whether we disable or enable the coffee tracker, users can still navigate to the
CoffeeList fragment which doesn’t seem quite right.
This is the second MAD Skills article series on Navigation. In this article we’ll take a look at another use case where UI components, such as action bar, bottom tabs or a drawer, are used to navigate between different parts of an app. If you prefer to consume this content in a video format, check it out here:
In the previous navigation series, Chet developed an app for tracking donuts. But what goes well with a donut? (besides a second donut): Coffee! So I decided to add functionality to track coffee as well.
I need to add more destinations…
Kotlin Vocabulary: Delegates part 2
Delegates help you delegate tasks to other objects and provide better code reuse which you can learn more about in this article. Kotlin not only supports an easy way to implement delegates with
by keyword but also provides built-in delegates such as,
notNull(), in the Kotlin Standard Library. Let’s see these built-in delegates and how they work under the hood.
lazy() function is a property delegate that helps you to lazily initialize properties, that is when they are first accessed.
Kotlin Vocabulary: Delegates
One way to get some work done is to delegate that work to another party. No, I am not talking about delegating your work to your friend, but delegating work from one object to another.
Guess what, delegation is not new to software. Delegation is a design pattern in which an object handles a request by delegating to a helper object, called the delegate. The delegate is responsible for handling the request on behalf of the original object and making the results available to the original object.
Kotlin makes delegation easier by providing support for class and…
Imagine developing an app where you need to deal with time calculations. After some googling, you’ll most likely end up finding great samples with the java.time package! However, after releasing your app, suddenly you get thousands of crashes and complaints from users on API < 26!
Want to know the reason? Watch the video or read the blog below.
The reason is that the devices which encountered the issues simply didn’t ship with the necessary classes, as at the time those classes were not part of Android.
With each new release of Android additional java.* APIs are added from…
The title might sound like a B-rated horror movie, but in reality, Kotlin’s “reified” keyword helps you do things that were not possible before. Generics provide type safety and help you avoid explicit type casts. Generics extend the type system to allow a type or method to operate on objects of various types while providing compile-time type safety. On the other hand, generics can be limiting when you need to access type info in a generic function, and the compiler tells you the info doesn’t exist!
In Java, the
static keyword is used to denote methods and properties that belong to an object, not to an instance of an object. The
static keyword is also used to create Singletons, one of the most widely used design patterns. Singletons help you to create a single instance of an object, which can be accessed and shared by other objects.
Kotlin has a more elegant way to deal with this. You can use a single keyword:
object, to implement the Singleton pattern. Read on to find out the differences between implementing a Singleton in Java vs Kotlin, how you…
Creating and managing local databases is a core component of most mobile apps. But whether you’re using SQLite directly or through the Room persistence library, Android developers have been asking for a better way to inspect and debug databases in their running app. To learn more watch the video or read the blog below.
The latest version of Android Studio 4.1 (currently available in Canary) comes with a new tool called Database Inspector, which helps you inspect, query, and modify databases in your running app.
Code geek, Developer Advocate @Google