72 Topics

Member Avatar for
Member Avatar for dimitrilc

## Introduction ## In a previous tutorial, we learned [how to create a notification on Android](https://www.daniweb.com/programming/mobile-development/tutorials/536756/android-native-how-to-create-a-notification#post2282507). In that tutorial, we did not have to request any permission because applications did not need permission to post notifications on Android 12 and below. It has been almost a year since the release …

1
440
Member Avatar for dimitrilc

## Introduction ## In a previous tutorial, we learned [how to set an exact alarm](https://www.daniweb.com/programming/mobile-development/tutorials/537920/android-native-how-to-launch-activity-from-an-exact-alarm). A permission called `SCHEDULE_EXACT_ALARM` was used in that tutorial. Initially, I thought that it was only a normal install-time permission, but I have recently found out that this specific permission also belongs to a rare …

1
267
Member Avatar for dimitrilc

## Introduction ## When working with ViewModels, instead of using the default, it is best practice that we inject coroutine dispatchers instead of hard-coding them. The reasoning behind this is that it is easier to switch to a testable dispatcher in tests. In this tutorial, we will learn how to …

1
901
Member Avatar for dimitrilc

## Introduction ## When working with RecyclerView, sometimes we are required to scroll the RecyclerView in code, especially after addition of a list item. In this tutorial, we will learn how to scroll to specific positions on a RecyclerView. ## Goals ## At the end of the tutorial, you would …

1
414
Member Avatar for dimitrilc

## Introduction ## Taking what we already learned from the previous tutorials about drawing custom shapes and animating along elements along a Path. In this tutorial, we will combine what we learned about animation so far to create an alternating Yin Yang symbol. To those unfamiliar with the Yin Yang …

1
86
Member Avatar for dimitrilc

This is the second part of a series. The first part can be found [here](https://www.daniweb.com/programming/mobile-development/tutorials/538948/android-native-animate-alternating-yin-yang-symbol-part-1). ## Draw The Yin ## Now that we have the Yang drawn, we will continue onto the Yin. 1. Add the Paint for the Yin into the YingYang class. We will use a *stroke* style …

1
71
Member Avatar for dimitrilc

## Animation Strategy ## Welcome to part three of the tutorial; part two can be found [here](https://www.daniweb.com/programming/mobile-development/tutorials/538947/android-native-animate-alternating-yin-yang-symbol-part-2). For this animation, I have chosen to redraw the YinYang Drawable at each frame. This means recreating the YinYang object with different constructor parameters on every frame (the current YinYang implementation has a …

1
66
Member Avatar for dimitrilc

## Introduction ## Welcome to part two of the tutorial. Let us continue to learn how to animate views along a Path. Part one can be found [here](https://www.daniweb.com/programming/mobile-development/tutorials/538944/android-native-animate-view-along-path-part-1). ## Important Coordinates ## Both the sun and the moon in our app can occupy any one of the three important coordinates …

1
41
Member Avatar for dimitrilc

## Introduction ## In the last tutorial, we learned [how to draw complex shapes](https://www.daniweb.com/programming/mobile-development/tutorials/538943/android-native-draw-complex-shapes-using-the-path-class#post2288657) using a Path object. Using the concepts from the previous tutorial, we will now attempt to animate Views to move along a custom Path. ## Goals ## At the end of the tutorial, you would have …

1
74
Member Avatar for dimitrilc

## Introduction ## In the last tutorial, we learned [how to draw basic shapes](https://www.daniweb.com/programming/mobile-development/tutorials/538942/android-native-draw-basic-shapes-on-canvas) on Android using premade methods from the graphics library. In this tutorial, we step up the difficulty a notch by learning how to draw using the Path class. The Path class allows for drawing of technically …

1
299
Member Avatar for dimitrilc

## Introduction ## Even though the built-in vector library included in Android Studio contains many icons readily for use, you might eventually run into a situation where a custom icon is needed. In this tutorial, we will learn how to create our own icons from basic shapes drawn on a …

1
220
Member Avatar for dimitrilc

## Introduction ## Android includes many options to add animations to your app. In this tutorial, we will learn how to add a type of animation called frame-by-frame animation into our Android app. ## Goals ## At the end of the tutorial, you would have learned: 1. How to add …

1
202
Member Avatar for dimitrilc

## Introduction ## Every Android View has a `layoutParams` property. This property tells the parent ViewGroup how a View wants to be laid out; it is also often used to change the size of a View. In this tutorial, we will learn how to animate Views while modifying their `layoutParams`. …

2
172
Member Avatar for dimitrilc

## Introduction ## Cards are a common widget for Material 3-themed applications. Expanding a card after the user performs a click action is a very common behavior. While Android can automatically render the new expanded card automatically, we will have to implement our own animation if we want a smooth, …

2
372
Member Avatar for dimitrilc

## Introduction ## When working on Espresso tests, you might have run into a situation where you need to verify what your app does when an activity is in a specific [**Lifecycle**](https://developer.android.com/reference/androidx/lifecycle/Lifecycle) state. In this tutorial, we will learn how to achieve this by using the **ActivityScenario** class. ## Goals …

2
41
Member Avatar for dimitrilc

## Introduction ## In the last tutorial, we learned [how to send messages to a RabbitMQ queue](https://www.daniweb.com/programming/web-development/tutorials/538621/how-to-send-messages-in-rabbitmq). In this tutorial, we will learn how to consume those messages in Kotlin. ## Goals ## At the end of the tutorial, you would have learned: 1. How to use the RabbitMQ Java …

1
2K
Member Avatar for dimitrilc

## Introduction ## While **Functional Interfaces** and **Function Types** are used to declare the types of a function, **Function Literals** create the actual implementations of these types. In this tutorial, we will learn what Kotlin **Function Literals** are and how to create them. ## Goals ## At the end of …

Member Avatar for Klint
2
183
Member Avatar for dimitrilc

## Introduction ## Whenever I want to express method parameters, return type or variables as a *method* in Java, I often find myself having to do a bit of work: 1. If I cannot remember which pre-made **functional interface** to use, then I will have to look up the list …

1
131
Member Avatar for dimitrilc

## Introduction ## In Android projects, **DataSource** classes act as entry points to interacting with local or remote data sources. Their dependencies tend to be HTTP clients, the database, or DAOs, and their dependents are usually **Repository** classes. In this tutorial, we will learn how to provide a fake **DataSource** …

3
634
Member Avatar for dimitrilc

## Introduction ## In this tutorial, we will learn how to create an instrumented test for Navigation Components. ## Goals ## At the end of the tutorial, you would have learned: 1. How to test Navigation Components. ## Tools Required ## 1. Android Studio. The version used in this tutorial …

1
819
Member Avatar for dimitrilc

## Introduction ## In this tutorial, we will learn how to load data asynchronously into a **ListAdapter** (*a subclass of **RecyclerView.Adapter***). ## Goals ## At the end of the tutorial, you would have learned: 1. How to serve asynchronous data to a **ListAdapter**. ## Tools Required ## 1. Android Studio. …

1
295
Member Avatar for dimitrilc

## Introduction ## In this tutorial, we will learn how to filter and validate Intents fired from the application under test. ## Goals ## At the end of the tutorial, you would have learned: 1. How to filter and validate Intents in Espresso tests. ## Tools Required ## 1. Android …

1
67
Member Avatar for dimitrilc

## Introduction ## When working with Espresso tests, you might have found it hard to make Espresso wait for background tasks to complete before performing other actions or assertions. Fortunately, the classes in the Espresso **idling** package exist to cover this use case. In this tutorial, we will learn how …

1
458
Member Avatar for dimitrilc

## Introduction ## Starting from Android 10 (*API 29*), Android places many restrictions on how apps can launch activities from the background. There are a couple of exemptions, which can be found on this [list](https://developer.android.com/guide/components/activities/background-starts#exceptions). At the end of the list is the usage of the *dangerous* permission `SYSTEM_ALERT_WINDOW`. I …

1
153
Member Avatar for dimitrilc

## Introduction ## When working with Room, you might have run into a situation where you only want to update specific fields of an entity instead of replacing the entire row. In this tutorial, we will learn how to do this in two different ways. ## Goals ## At the …

2
2K
Member Avatar for dimitrilc

## Introduction ## On the android platform, widgets provide a quick way to interact with your Apps. They are extremely useful at providing quick information without the user launching the app Activities themselves. Common use cases for homescreen widgets are weather, email, or banking information. In this tutorial, we will …

2
208
Member Avatar for dimitrilc

## Introduction ## In this tutorial, we will learn how to use **ConcatAdapter**. It is a great choice for displaying header or footer at the beginning or at the end of a **RecyclerView**. ## Goals ## At the end of the tutorial, you would have learned: 1. How to use …

2
330
Member Avatar for dimitrilc

## Introduction ## Rather than modifying the button widget’s appearance in code, it is possible to do this in an XML resource instead. In this tutorial, we will learn how to create two different types of specialized XML resource files for changing the **Drawable** and the color. ## Goals ## …

2
91
Member Avatar for dimitrilc

## Introduction ## The Android platform provides many different types of menus to be added to an Android app. In this tutorial, we will learn how to add the most common type of menu, an **Options Menu**. An **Options Menu** is one that appears at the right corner of the …

1
120
Member Avatar for dimitrilc

## Introduction ## The Android platform provides many different types of menus to be added to an Android app. In this tutorial, we will learn how to add **Contextual Menu**s to our app. ## Goals ## At the end of the tutorial, you would have learned: 1. How to add …

1
216

The End.