Skip to main content


Showing posts from July, 2020

How to make Tabs with swipeable view in Android [2020]

Make Tabs with Swipeable Layout using ViewPager2 and TabLayout

Hello world, today we are going to see how to make a swipeable view using ViewPager2 and TabLayout. We will see how to use fragment and how to sync tab layout indicator with ViewPager2 swipes. We will set the tab layout title to the tabs and then inflate our views in viewpager. Let's look at the finished app in the below gif.
To make the swipeable views, first, we need to add a required dependency for our project.
Add Dependency for TabLayout Open your build.gradle file app level and in the dependency section and add these dependencies. We need this dependency to use TabLayout.

After adding and syncing the project. Let's add TabLayout and ViewPager2 in our activity XML file. Add TabLayout and ViewPager2 in Activity XML Add the below code in the activity_main.xml or your activity xml file.

In the above code, we have added the TabLayout with some attributes properties.
We set the minimum…

Firebase Cloud FireStore Database in Android | Beginner Android Tutorial

How to use Firebase Cloud FireStore Database in Android

Hello World, today we are going to see how we can make a todo app using a firebase cloud firestore database. The Firestore database is a very flexible and scalable NoSQL database to make our development very fast. Firestore is very easy to use in android. FireStore can work every smoothly even of your device is offline it can fetch data from the cache in the device so that your app can work offline and update the data when it connects to the internet again. This functionally makes your app for interactive for the users. Firestore database has one more feature is to watch realtime changes in the database and you can show updates in the app. 
Firestore database can execute queries so that you can filter your data as per your requirement, this feature makes the firestore database more likely to choose for your project.
Firestore database stores the data in the documents and these docu…

How to make Dark (Night) Mode Theme in Android | Android Tutorial

How to make Dark (Night) Mode Theme in Android

Hello World, today we are going to see how we can implement a dark theme or night mode in our android application. This tutorial is going to be very simple and easy to understand. The dark theme is attractive to users and it is comfortable for low light conditions. Recently many apps adapt dark mode in their app and the output of the night mode is amazing as many users love dark mode for their app. An example of a dark theme is Whatsapp dark mode in android see the below image.

Let's look at how our app will look like, see the below gif for our end result app.

Let's see how we can implement dark theme in our app.
Make layout for dark theme First, we need to make our layout so that we can apply our dark theme to it.
If you see the above gif we used cardview to make our layout.
See the below code for layout.

Now we need to set theme colors in the layout, for example, we need to set the background color of activity and c…

Custom Switch in Android | | Android Tutorial

How to make Custom Switch in Android?

Hello World, Today we are going to make a custom switch. Why? Because the default one looks so boring and ugly. Why we use a switch? As the name suggests, the switch is used to trigger the value either it is on, or it is off. Let's see, how our custom switch will look at the end of the tutorial.

In the above gif, there are 3 switches. The First one is the default one and the second and third are our custom switches. To make these custom switches we need to follow certain steps are as follows:
Step 1. Add Switch to Activity Layout First. we need to add the switch to our layout XML file. We will add SwitchCompat to the layout.
Look at the below code for better understanding.

In the above code, things to be noticed are app:track and android:thumb attributes.
The track is the horizontal container where our thumb or round shape view is placed and the thumb is, as I told you before, is the round shape where we will add …

How to make custom toast in Android with Example

Android Custom Toast With Example
Hello World, today we will be going to see how we can make custom toast and in this tutorial, we will see custom toast with an example. See below as an example.

Before starting let's see.
What is Toast? When to use it? Toast is a view that contains text which notifies the user with some information.
We can use toast when we want to notify the user.
Making Custom Toast with ExampleTo make custom toast we need to follow certain steps as follows.
Step 1. Create a Custom Layout for Toastthe first step is to make a layout file for our toast.
To make a layout file, right-click on layout folder under res and select new -> layout resource file.
we will name this file as custom_toast.xml and in this file, we will make our layout which will b shown in the toast. Check the below code for the layout file.

In the above code, we set the id to the parent view and we added an imageview and a textview.
We are keeping things simple so that you…

Working with Bottom Navigation bar in Android [Full Guide]

How to make Bottom Navigation bar in Android
Hello World, Today we are going to learn how we can make a nice bottom navigation bar in android. We will see how we can implement bottom navigation and how to work with fragments and many other things and trust me you will enjoy this tutorial. Before making our bottom navigation bar lets look at our final result. See the below gif.

This is a clean and material design based bottom navigation bar. So let's see how to code this.
Add Bottom Navigation Bar Dependency To make the bottom nav bar, first, we need to add the dependency for the bottom navigation bar.
Open your build.gradle file and add this dependency.
After adding the dependency hit the sync button and after syncing the project, we can use BottomNaigationView in our layout file.
Add BottomNavigationView in Layout Open your layout file and in the layout XML, we need to add 2 things. The first thing is FrameLayout, which will contain our fragments and the second…