Many apps such as the E-commerce app requires to accept payments from their users for providing different products or services or for their users. So this apps requires the users to enter bank details for payments. In this payment gateway, users are asked to add their banks IFSC code to get the details of their banks. So many apps have features inside their app that while entering the bank IFSC code the user’s bank details such as Bank address, bank city, and other common details are fetched from that IFSC code. So in this article, we will take a look at How we can get the common bank details from the IFSC code in Android.
What we are going to build in this article?
We will be building a simple application in which we will be getting IFSC code from the user via an EditText and after that, the user has to click on a simple button to get the data from that IFSC code such as Bank address, bank MICR code, contact number, and other details. For performing this task we will be using a simple API which we will be added to our application. This application will provide us the basic data from API which is related to the bank. Below is the GIF image in which we will get to see what we are going to build in this article. Note that we are going to implement this project using the Java language.
Step by Step Implementation
Step 1: Create a new project in Android Studio
To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.
Step 2: Add the below dependency in your build.gradle file
Below is the dependency for Volley which we will be using to get the data from API. For adding this dependency navigate to the app > Gradle Scripts > build.gradle(app) and add the below dependency in the dependencies section.
After adding this dependency sync your project and now move toward the XML part.
Step 3: Working with the activity_main.xml file
Go to the activity_main.xml file and refer to the following code. Below is the code for the activity_main.xml file.
Step 4: Working with the MainActivity.java file
Go to the MainActivity.java file and refer to the following code. Below is the code for the MainActivity.java file. Comments are added inside the code to understand the code in more detail.
Step 5: Add permission for the internet in the Manifest file
Navigate to the app > AndroidManifest.xml file and add the below permissions to it.
After adding this permission. Run your project and see the output on the below screen.