Photo by Aleks Marinkovic on Unsplash

Retrofit is a type-safe network library that makes android applications easy to consume RESTful web services. It is built by Square and makes it easy to get JSON or XML data which is parsed into Plain Old Java Objects (POJOs).
In simpler language Retrofit is a library that makes our life easier by providing an easy way to make network transactions. It’s very fast and easy to upload or retrieve data from the server via the Rest-based web service.

Retrofit 2 by default leverages OkHttp as the networking layer and is built on top of it.

Retrofit automatically serializes the…

Room library provides an abstraction layer over SQLite to allow fluent database access while harnessing the full power of SQLite.

When we think about saving data to a database the first thing that comes to our mind is SQLite. Although SQLite is a very powerful way to save the save it requires a lot of code that doesn’t provide real value. The architecture it follows is a little fuzzy and complex to understand. The answer to this problem is ROOM. It allows us to create and manage databases more easily without compromising security and integrity.

Benefits of using ROOM

  • Compile-time verification of SQL queries.

View your data stored in the database directly from your android studio using Database inspector. Much awaited feature is finally here.

Creating and managing a local database has been one of the most common and important aspects of an android application. Till now developers relied on third-party software and what not to view and manipulate data inside the database.

Finally, prayers of developers have been heard by the google and they have released the database inspector in Android studio 4.1. You cannot just view data but also query and manipulate live running data in the application.

Opening Database Inspector

To open the Database…

RecyclerView is a very flexible and powerful widget and you might have used only one layout to display the list but you can use more than one layout in the same ViewGroup.

In this article we will take the example of two layouts in the same recyclerView, One would be the smaller cardView with two textViews and other would be the bigger layout with 3 textViews and width matches the parent as can be seen below

Android View binding makes it easy to write a code that interacts with layouts i.e you can easily access the layout in XML from java file without using findViewById()

View binding is enabled on a module by module basis and in most cases, it replaces the need to write findViewById(). I am not sure about anyone but I always found it tedious to write findViewById() for every view

Advantages of Android View binding

  • Less boilerplate code
    No need to write findViewById() repeatedly, hence less lines of code.
  • Null safety
    It’s a common mistake to mention the wrong id of view inside findViewById() and getting a null…

RecyclerView listing can be defined in more than one way using different LayoutManager i.e items can be arranged in different ways depending upon what kind LayoutManager one might be using.


RecyclerView is a more advanced, flexible and optimized version of ListView.
It is used when you want to display a list of things. This widget is used to display a large number of data sets that can be scrolled efficiently

The RecyclerView model does a lot of optimization work so you don't have to:

  • When the list is first populated, it creates and binds some view holders on either side…

Photo by Ketut Subiyanto from Pexels

The basic concept of iteration and recursion are the same i.e execution of the same set of instructions again and again. Let’s have a look at both of them using a simple example to find the factorial of a number

In iteration loop repeatedly executes until the controlling condition becomes false

private static int factorialIterative(int number) {
int ans = 1;
for (int i = 2; i <= number; i++) {
ans *= i;
return ans;


In recursion, the method calls itself repeatedly until a condition is met.

private static int factorialRecursion(int number) {…

Nandish swarup

Android | Kotlin | Full stack developer | Blogger

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