If you have knowledge, let others light their candles in it.
-Margaret Fuller

Android Jetpack introducing new concepts day by day. Now, Jetpack introduce another data storage solution “Data Store”. Now, It is in beta.

What is Data Store?

It is a data storage solution. It uses Kotlin coroutines and Flow to store data asynchronously, consistently, and transactionally. Just like Shared Preferences, It also allow us to store data in key-value pairs and typed objects with help of protocol buffers.

Types of Data Store

There are two types of Data Store : Preferences Data Store, Proto Data Store.

Preferences Data…


Love of learning is the most necessary passion … In it lies our happiness. It’s a sure remedy for what ails us, an unending source of pleasure
— Emilie du Chatelet

We all are using Recycler view to show the list of items in app. But when the time comes to update the data then we just called notifyDataSetChanged() which is very costly operation because it updates the whole view. So here, DiffUtil comes into the picture, it just update those views that were actually changed…

DiffUtil is a utility class that calculates the difference between two lists and outputs…


Sharing knowledge is the most fundamental act of friendship. Because it is a way you can give something without loosing something.
-Richard Stallman

Most of the developers facing the problem of restore the recycler view position when view recreated (on rotation). But Finally Android come up with StateRestorationPolicy to solve this problem. So, Let’s get deep dive into this article and after reading this article please try with yourself….

Starting from 1.2.0-alpha02, Recycler View introduces a new API to let the Adapter block layout restoration until it is ready.

State Restoration Policy has 3 states.
ALLOW
PREVENT_WHEN_EMPTY
PREVENT

ALLOW

This…


Share your knowledge. It’s a way to achieve immortality.
-Dalai Lama

This is the fourth and last series of articles which cover the fundamentals of using Constraint Layout. We will talk about Helpers in constraint layout.

Guideline

Utility class representing a Guideline helper object for Constraint Layout. Helper objects are not displayed on device (they are marked as View.GONE) and are only used for layout purposes. They only work within a Constraint Layout. A Guideline can be either horizontal or vertical.

Vertical Guidelines have a width of zero and the height of their Constraint Layout parent
Horizontal Guidelines have a height of…


An investment in knowledge always pays the best interest.
-Benjamin Franklin

We have already covered to create new layout, Constraint types and some shortcut attributes. Please go through this link: https://swatiomar09.medium.com/constraint-layout-part-ii-21a8d4c943f9

So let’s talk about Chains

Chains

A chain is a group of views that are linked to each other along with bi-directional position constraints. The views within a chain can be distributed either vertically or horizontally. We can also combine horizontal and vertical chains.

Creating a Chain

Press Shift and select all views and right click horizontal chain or select any one then change default spread mode to anyone, chain created but you…


The beautiful thing about learning is that nobody can take it away from you.
― B.B. King

We have already covered what is Constraint layout, Why it introduced and how to convert an existing layout to constraint layout. Please go through this link: https://medium.com/@swatiomar09/constraint-layout-part-i-2b05f3d4c987

So let’s proceed further…

Create New Layout

  1. In the Project window, click the module folder and then select
    File > New > XML > Layout XML.
  2. Enter a name for the layout file and enter “androidx.constraintlayout.widget.ConstraintLayout” for the Root Tag.
  3. Click Finish.

Note: When creating constraints, remember the following rules:

Every view must have at least two constraints: one…


We learn more by looking for the answer to a question and not finding it than we do from learning the answer itself.
-
Lloyd Alexander

In this tutorial, we are going to learn Constraint Layout. But To start learning let’s know what is constraint layout and why it introduced.

What is Constraint Layout?

Constraint Layout allows you to create large and complex layouts with a flat view hierarchy (no nested view groups).

Why it is introduced?

We already have Linear layout, Relative layout etc. But When we have to create large layouts then there will be nested view hierarchy which is very complex and hard to read. So…

Swatiomar

As a girl programmer, to keep learning and help ones who needs the skills to be a master, I am available to be a part of an adventurous journey….

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store