Android Jetpack’s Navigation component is a better approach in Android to navigate across, into, and back out from the different pieces of content within your app. This post shows you how to set up and work with the Navigation component.
For using the Navigation component we must first add the dependency in our Android project, you can get the dependency here.
Now after we have added our dependency, we must add a new resource file in our Android project. Let’s name our file
nav_graph and it must be of type Navigation.
In this post, we are going to learn how we can customize the style of the overflow menu of the toolbar.
First of all, let’s create a style for our overflow menu. Here, I am going to create a style named
CustomPopupMenuStyle and add some basic attributes related to altering the text style.
Now, as our style has been created let’s add it to our toolbar.
In this post, we are going to learn how to style AutoCompleteTextView to look alike Spinner. It will have both a dropdown feature like Spinner and a typing feature to help filter suggestions.
Firstly we should add a dropdown icon at the end of the view. For that, we can simply use the
android:drawableEnd attribute in our XML layout.
First of all, we must define Spinner in our XML layout.
Now let’s create a custom object which we are going to use in our Spinner.
As we have created a custom class, let’s define a variable for Spinner in our Kotlin code. Since we need to display data in our Spinner using an Adapter let’s also define an ArrayAdapter variable that holds our custom object.
Now, we should instantiate these variables in
onViewCreated() if it is a fragment or
onCreate() if it is an activity.
Also, let’s prepare a list of custom objects with sample data…
In this post, we will be learning how to use the Safe-Args feature which has been included in the Android Jetpack’s Navigation Component. This post is an extension to my previous post Getting Started with the Navigation Component, even if you haven’t checked my previous post you can continue reading but if you are unfamiliar with the Navigation Component then you should definitely check it out.
Before jumping straight into how we are going to use Safe-Args in the Navigation component, we should remember that in general, we should strongly prefer passing only the minimal amount of data between destinations…