ViewPager with TabLayout Android Studio

viewpager with custom tab

In this article we will learn how to create ViewPager with TabLayout Android Studio. We use ViewPager to create a view the works as Image Slider. In this tutorial I will use the ViewPager2 Class and accordingly I will use the RecyclerView Adapter Class. Lets create a new android studio project with Java language. First, we need to add the required dependences as following in the Gradle file, in module Gradle file. Note, that I am using the Java version of 1.8 and ViewBinding. Then, Open theme file in the…

Read More

How to Create SearchView in Android Studio

How to Create SearchView in Android Studio

In this article we will learn how to create SearchView in android studio. SearchView is a widget that enables the user to enter search query and then send the request to the search provider. After that it shows a list of suggestion or results. Copy the following xml code in main activity xml file. After that add the following code to the main activity java file. Now, run the app. You will find the result as the following image. Then open logCat in the bottom bar of android studio. In…

Read More

Setting ImageView in Android Studio

Setting ImageView in Android Studio

In this article talks about setting ImageView in android studio. ImageView is a View for displaying and manipulating image resources, such as Drawables and Bitmaps. See the following example to implement ImageView to switch between images I have saved in the drawable folder . Then, in the main activity past the following code. Not you need to save three image files in the drawable folder and make sure the files names are with lowercase letters, no numbers or spaces. The layout should be like this Now run the app and…

Read More

TextInput Layout in Android Studio

TextInput Layout in Android Studio

In this article we will how to work with TextInput Layout in android studio. We need to use TextInput Layout to display the floating label on EditText. Furthermore TextInputLayout wraps an EditText in order to display the floating label. Moreover, it supports showing the error and error icon. The TextInput Layout uses TextInputEditText as a child layout. Using TextInputEditText instead of an EditText provides accessibility support for the text field and allows TextInputLayout greater control over the visual aspects of the text field. An example usage is as so: TextInput…

Read More

Custom ListView in Android Studio

Custom ListView in Android Studio

In this article we will learn how to work with Custom ListView in android studio. ListView is a viewgroup which groups several items from a data source like array or database and displays them in a scroll-able list. Moreover, ListView uses the Adapter to bind the data. In order to create a ListView widget we need to add it in the xml file as following. ListView with Custom ArrayAdapter By default the ArrayAdapter class creates a view for each array item by calling toString() on each item and placing the…

Read More

AutoComplete TextView Android Studio

AutoComplete TextView Android Studio

In this article we will learn how to create AutoComplete TextView in android studio. Furthermore, autocomplete textview is used when we need to show a list of text like name, cities when the user type the first letters in the text. AutoComplete TextView is a UI widget. So that, when we need to create it we need to add it in the xml layout file as following: The AutoComplete TextView uses a list in order that we need to create adapter for this list. The adapter requires another XML layout…

Read More

Working with EditText in Android Studio

Working with EditText in Android Studio

In this article we will learn the working with EditText in android studio. The EditText is the standard text entry widget in Android apps. Moreover, If the user needs to enter text into an app, this is the primary way for them to do that. We can customize the behavior of an EditText by using several attributes as following. In order to get the text value in EditText we can use the following method. Furtheromer, We might want to limit the entry to a single-line of text (avoid newlines): Also,…

Read More

Customize TextView in Android Studio

Customize TextView in Android Studio

In this article we will learn how to customize TextView in android studio. TextView is a user interface widget that display and set text to the user. In order to create text view use the following example of TextView widget. Moreover, you can use the xml layout attributes to customize the TextView. Also, there is another way to customize TextView which is Spannable Text View. Through the next part of this article we learn how to use it. Moreover, when we want to use the text view in the java…

Read More

Button Click Listener in Android Studio

Button and Button Click listener

In this article we will learn how to create Button also how to create Button Click Listener in android studio. Buttons are the most used widgets in any android app. In other words the Click Listener interface also. In order to create Button we to add its widget in the XML file as following. Note that the attribute onClick, that specifies the action the will be done when the user click the button. This attribute take the name of the method in the linked java file. as following. Using the…

Read More

Layout Params in Android Studio

Layout Params in android studio

In this article we will talk about Layout Params in android studio. But first we need to know what is the layouts in android. A layout defines the visual structure for a user interface, such as an activity or widget. Moreover, we need to declare layouts in XML, including screen elements that will appear in it. Futhermore,we can add the code to the application to modify the state of screen objects at runtime, including those declared in XML. Layout Params Every single ViewGroup (e.g. LinearLayout, etc.) needs to store information…

Read More

XML layout Files in Android Studio

XML layout in android studio

Through the previous article we learned the activities and fragments in android studio. In both activities and fragment we used two types of files. The first is for designing the UI which is XML layout file, and the other is for writing the excitable java code. So, in this article it is important to know what is XML files and the language it works with. What is XML? XML stands for Extensible Markup Language. The World Wide Web organization created it to construct a syntax in the way that the…

Read More

Fragments in Android Studio

fragments in android studio

Through the previous articles we learned what are activities in android studio, what are intents and also activities life cycle. In this article we will learn learn what are fragments. Fragments are another part of the android app that represents a reusable portion of your app UI. A Fragment can determines and maintains it’s own layout and life cycle. Moreover, it can manage it’s own life cycle. One important note is that fragments can not exist on their own. Moreover, we must host the fragments by an activity or another…

Read More

Activity Lifecycle in Android Studio

Activity Lifecycle in Android Studio

In the previous articles we learned the activities in android studio. Also, we mentioned that the android app experience differs from its desktop one. This difference in that the android app doesn’t always begin in the same place. Moreover there is no a determined start for the android app. For that, in this article you will learn the concept of activity lifecycle in android studio. As a user navigates through, out of, and back to your app, instances of an activity in your app changes through different states in their…

Read More

Intent and Intent Filters in Android Studio

Intent and Intent Filters

In this article you will learn all about Intent and Intent Filters in android studio. An Intent is the way to request an action from another app component in form of messaging object. For example, when you want to start activity, send message or share image. The ways that intent communicate with app components. There are several ways where the intent communicate with app components. 1- Starting Activities In order to start activity in android you need to pass an intent to the method startActivity(). This intent should describe the…

Read More

Activities in Android Studio

activities android studio

In the previous articles of our android studio tutorials for beginners we learned how to create an android studio project. By default android studio create packages and files from which is the Main Activity java file. Surely, an activity class is a crucial component of any android app. So, this article is important as we introduce activities in android studio. What is Activity class?, an activity represents the window in which the app draws it UI. The mobile app differs from desktop app in that a user’s interaction with the…

Read More

Setup Android Emulator in Android Studio

Android Emulator

In this article you will learn how to setup Android Emulator in Android Studio after first installation of android studio. Android emulator is a simulation of android device on your computer. Moreover, it provides almost all the capabilities of a real android device. Further more, the emulator comes with predefined configurations for various Android phone, tablet, Wear OS, and Android TV devices. Android Emulator Requirements and recommendations In addition to android studio system requirements, android emulator has the following requirements. SDK Tools 26.1.1 or higher. 64-bit processor. Windows: CPU with UG…

Read More

Android Studio User Interface and Project Structure

Android Studio User Interface and Project Structure

In this article You will be familiar with the android studio user interface and the android project structure. Android Studio is the official Integrated Development Interface (IDE) and id dependent on IntelliJ IDEA. Moreover it provides developers with more features that enhance your productivity when building Android apps. Features like a flexible Gradle based build system, fast and feature-rich emulator, apply Changes to push code and resource changes to your running app without restarting your app, code templates and GitHub integration to help you build common app features and import…

Read More

Create An Android Studio Project

create new androidproject

Welcome to the first practical android tutorial for beginners. In this article you will learn how to create your first android studio project after Installing Android Studio. In order to create a new android studio project, open android studio. Then, you will see “welcome to android studio” window as following. Next, click on “Create New Project”, a new window will appear. This window contains templates for android studio projects. Such as, Navigation Drawer Template, Google Maps and Simple Login one. We will study these templates later. But for now we…

Read More

Preference API | Build Settings UI in Android Studio

Preference API | Build Settings UI in Android Studio

In this article we will learn how to build Settings UI in android studio using Preference API. To clarify more, in app setting allows the user to change the functionality and behavior of your app. Furthermore, it can affect the background behavior such as change the app data synchronization. Moreover, settings can affect the app content and user interface. AndroidX Preference API is the recommended way to integrate user settings in your app. Moreover, this library comes with material theme that provides a consistent user experience across devices and OS…

Read More

Data Binding in Android Studio

data binding in android studio

Lets start a professional way in android app development by using Data Binding in Android Studio. Furthermore, data binding library enables you to bind the UI components in the layout files to the app data sources. Moreover, it lets you to remove many UI framework calls in your activity. So that, it improve your app’s performance and help prevent memory leaks and null pointer exceptions. When data binding is enabled it generates binding class that takes the name name of the XML layout files with camel case and adding the…

Read More

View Binding in Android Studio

view binding android stduio

Imagine that you are working on an android studio project and it contains lots of views. How many times that you should write findViewByID() !!!. Moreover, how many times your app crashed due to view null pointer exception. So that, View Binding in android studio solves theses issues. Furthermore, this feature allows you more easily to write code that interacts with Views. As, once it enabled it generates a binding class for each XML layout file. Simply, the main_activity.xml file if related to MainActivity.java file. So, after enabling View Binding…

Read More

Room Database Queries Using DAO

room database queries using dao

The first two articles, we have learned how to create Room database in android studio. Also, we quickly learned how to insert, update, delete and collect rows from it. If it is the first time to visit Android Hands website, you can use the below links to study Room Database from the first part. Furthermore, In this article we will learn in depth how use Room Database Queries in Android Studio Using DAO (Data Access Objects). 1- Room Database in Android Studio through simple To Do List App. 2- Room…

Read More

Room Database Entities Relationships

room relationship between entities

In this article we will firstly discuss what is Room database entities relationships. Also, what are the types of relationships between entities. After that, we will apply the most common relationship in our to do list app. As, we will learn how to add sub items for each item created in the To-Do list app. Moreover we will use Nested RecyclerView to show the horizontal sub items. In the linked article below, we learned how to create simple to do list app using Room Database. Also, we learned how to…

Read More

Room Database Migration Android Studio

room database migration android studio

When we use Room database in our android project, we need to add or make changes in the database. Imagine that you published your app and the users added their data in the app database. Then, you have upgraded the app database and launched a new update for your project. In this case, the users lose their database. So, it is important to preserve users data that already saved in their devices when you change the database schema. For this reason, we need to understand Room Database Migration in Android…

Read More

Room Database Android Studio

room database android studio

This tutorial describes how to create Room Database in Android Studio. It is part of Local Persistence tutorials. Local Persistence means the storage of data to the device for later use, even after the program that created it has been closed. Apps that handle non-trivial amounts of structured data can benefit greatly from persisting that data locally. The most common use case is to cache relevant pieces of data. That way, when the device cannot access the network, the user can still browse that content while they are offline. Any…

Read More

Firebase Facebook Authentication Android Studio

Firebase Facebook Authentication Android Studio

This article describes how to create Firebase Facebook authentication in android studio. If it is the first time to see Firebase tutorials. The article of this link describes how to connect android studio project to Firebase. Facebook login button is the most preferred, fast and convenient tool for android application users. As you can allow the users to create their accounts and log into your application through multiple platforms. So, in this article we will integrate Firebase Facebook Authentication in Android Studio. The next steps depending on that your android…

Read More

Firebase Email Authentication Android Studio

Firebase Email Authentication Android Studio

This article describes how to create Firebase email authentication in android studio. if it is the first time to see Firebase tutorials, The article in this link describes how to connect android studio project to Firebase. Many apps require to know the identity of the user. More over, you need to securely save users data. Firebase email authentication allows users to sign up with their email and password. So that, I will describe step by step how to add Email and password authentication to your app. In the previous article…

Read More

Synchronize MySQL to SQLite in Android Studio

Synchronize Mysql to SQLite Android Studio

This tutorial describes how to Synchronize MySQL to SQLite in Android Studio. I have designed the tutorial as simple chat app between web page and android application. In the following image, When User 1 send message from web or android device to the server, the message will be saved to MySQL database. At the same time Firebase notification will be send to the receiver (user 2). On message receive at user 2 device the app will collect message from MySQL and save it permanently to SQLite database. Synchronize MySQL to…

Read More

Connect Android Studio Project to Firebase

connect android project to firebase

This tutorial describes how to Connect Android Studio Project to Firebase. Simply, I will Firebase plugin in android studio. However, If you have already installed Firebase plugin in android studio, just scroll down to the second part. Install Firebase Plugin in Android Studio Start a new android studio project and after project synchronized successfully open file menu and select setting. Next, From settings window select plugin then marketplace then search for Firbase. Install Firebase Service Plugin. The plugin installation requires to restart android studio IDE. After that open plugins and…

Read More

Custom Android Spinner

custom android spinner

Custom Android Spinner Tutorial Custom Android Spinner tutorial describes how to create android spinner linked with multiple values on item selection. Some times we need to bind string value of spinner item with other values as integer …. and set on item selected listener of spinner also describes how to change spinner text size, color and padding. Create a new android studio project and open main activity XML file. Then add Spinner and TextView that shows the linked value of Spinner Adapter. <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”match_parent”…

Read More

MP PhilJay Bar Chart Android

android mp philjay bart chart android studio

Android MP PhilJay Bar Chart Android Studio This tutorial describes how to create Android MP PhilJay Bar Chart Android Studio with MP PhilJay liberary and how to use bar entry from array list. and also describes how to create onClickListenter to show each bar in the chart value in alert dialog. Android mp philjay charts library is jitpack library which is maven repositories. So, it requires jitpack.io dependency. Lets start. MP Philjay Bar Chart Dependencies Start a new android studio and open project level gradle file, then add the jitpack…

Read More

MP PhilJay Pie Chart

android MP Philjat Pie chart

Android MP PhilJay Pie Chart Android Studio This tutorial describes how to create Android MP PhilJay Pie Chart Android Studio with MP PhilJay liberary and how to use bar entry from array list. and also describes how to create onClickListenter to show each Pie chart value in alert dialog. also, you will learn how design and show data for each pie slice. like setting the legend, colors, setting X and Y value position. what ever you need inside slice or outside the slice. Android mp philjay charts library is jitpack…

Read More

Create Nested ReyclerView Android

android nested recyclerview

How to Create Nested Recyclerview android studio This tutorial describes how to Create Nested ReyclerView Android. Nested RecyclerView is the idea of play store application or e-commerce application or music application. You can scroll vertically through parent RecyclerView. Each row of parent RecyclerView represents the type or category and contains horizontal(child) RecyclerView . The child RecyclerView contains product details. Moreover, I will concentrate on outOfBoundIndex error that may appear with you when you create it. When the Array List size of the child RecyclerView is equal for all parent RecyclerView…

Read More

MP Philjay group Bar Chart with retrofit

MP PhilJay group Bar Chart

Android MP PhilJay Group Bar Chart using Retrofit This Tutorial describes how to create MP PhilJay group bar chart in android using retrofit. In contrast, Most of published tutorials describe group bar chart with a defined number of data sets. Therefore, This tutorial solves the problem of fixed group space and bar width. In contrast, when the user click on button it shows the sales per product per month. Accordingly, we have three data sets. More over, If the user made another click on the button the chart will display…

Read More

Android SQLite Database Tutorial

Android SQLite Tutorial

Android SQLite Tutorial Android SQLite Database Tutorial is part of local persistence tutorials. Local Persistence means the storage of data to the device for later use, even after the program that created it has been closed. Options: 1.Using a SQLite database and Room Database. This is (obviously) the most powerful option, especially for querying data. 2.Using shared preferences. This is great for simple data, it’s very easy to use. Probably not the best way to store complicated objects or large amounts of data. 3.Using local files. Not good for querying…

Read More

Custom Calendar View With Events Android

Custom Calendar View With Events Tutorial

Custom Calendar View With Events Android This tutorial you will learn how to create a custom calendar view with events and notifications.You can use android Calendar Instance, and you can inflate calendar days of the month by using grid layout and linear layout manager. You can use any type of database whether it is local database like SQLite and ROOM database or remote database like MySQL or Firebase database. So the calendar has flexibility to add, update and delete user`s events. The custom calendar view has been designed to allow…

Read More