Let’s Build User Profile UI With Android for our E-Commerce App
We are going to create an android UI for our UserProfile backend API we are creating for our demo E-commerce tutorial
Introduction
We are building an e-commerce platform from scratch. In the last tutorial, we build the backend for the UserProfile
In this article, we will build the android UI for the UserProfile backend, which can be a base for many other applications.
Not long before was the time when the user profile consisted of a hard copy form. From the advent of digital technology and sophisticated software, profiles have been becoming more intuitive.
Backend API description
Here we describe the most important component of our user profile application: the REST API. A REST API is an application that uses the existing protocol stack for data communication between different applications on the web. Here, we are using a web API to communicate between our android application and a remote database for user data storage. Our API handles the GET and POST request which basically allows the android application to create and fetch data from the database.
The API used here is created using Java and Spring Boot framework. Spring is a popular application development framework, developed for the enterprise edition of the Java programming language. You can find detailed project files for the REST API over here.


Android Studio is the official Integrated Development Environment (IDE) for Android app development, based on IntelliJ IDEA. On top of IntelliJ’s powerful code editor and developer tools, Android Studio offers even more features that enhance your productivity when building Android apps, such as:
- A flexible Gradle-based build system.
- A fast and feature-rich emulator.
- A unified environment where you can develop for all Android devices.
- 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 sample code.
- Extensive testing tools and frameworks.
- Lint tools to catch performance, usability, version compatibility, and other problems.
- C++ and NDK support.
- Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine.
The benefit of using Android Studio over any other IDE is we get a rich set of features built-in which enable us to focus more on the development aspect while the back-end of this IDE handles the requirements and dependencies. For this project, an existing API endpoint has been used for database connectivity.
Prerequisite:
Before we start developing, we need to check off a few requirements:
- You will need to have a Java JDK installed on your system. You can find the instructions for installing the JDK here.
- You will need to install Android Studio on your system.
- Lastly, we can use our Android smartphone with USB debugging enabled for testing the android app or we can use the built-in Android emulator from Android Studio (I have used my smartphone for testing and debugging).
Project Setup and Structure:
Once you install Android Studio on your system, you can start with creating a new project.

To create your new Android project, follow these steps:
- In the Welcome to Android Studio window, click Start a new Android Studio project.
- In the Select a Project Template window, select Empty Activity and click Next.
- In the Configure your project window, complete the following:
- Enter “User Authentication” in the Name field.
- Enter “com.example.userprofile” in the Package name field.
- If you’d like to place the project in a different folder, change its Save location.
- Select Java from the Language drop-down menu.
- Select the lowest version of Android your app will support in the Minimum SDK field. I have selected API level 22 (Android Lollipop).
- Leave the other options as they are.
4. Click Finish.
After some processing time, the Android Studio main window appears.
Now take a moment to review the most important files. First, be sure the Project window is open (select View > Tool Windows > Project) and the Android view is selected from the drop-down list at the top of that window. You can then see the following files:
- app > java > com.example.userprofile > MainActivity
This is the main activity. It’s the entry point for your app. When you build and run your app, the system launches an instance of this Activity and loads its layout.
- app > res > layout > activity_main.xml
This XML file defines the layout for the activity’s user interface (UI). It contains a TextView element with the text “Hello, World!”
- app > manifests > AndroidManifest.xml
The manifest file describes the fundamental characteristics of the app and defines each of its components.
- Gradle Scripts > build.gradle
There are two files with this name: one for the project, “Project: User Authentication” and one for the app module, “Module: app.” Each module has its own build.gradle file, but this project currently has just one module. Use each module’s build.gradle file to control how the Gradle plugin builds your app. For more information about this file, see Configure your build.
Before you run your first app, get your smartphone, and enable USB debugging by following the instructions over here. After, enabling USB debugging, connect your smartphone to your PC and you are ready to go.
In Android Studio, select Run > Run ‘app’ or click the Run icon in the toolbar.
Congratulations on creating your very first app. But you are far from what we have to achieve. Next, we need to create the rest of the application.
Setting up the files:
Let’s start with app > res > drawables. This is the directory where we will be storing all the graphical elements for our application. We are going to store three different categories of graphic elements.
- Image. (filename: background.jpg)
- Icon elements. (filenames: account.xml, email.xml, pencil.xml)
- Custom graphic file. (round_button.xml)
The image used here is for the background of the UI. You can use any image you like but be sure to use the same file name for the next part where we will be coding the back-end and creating activity layouts.
Icon elements are XML files for vector graphic icons used in our application. You can find and download these files from here.
The custom graphic file here is used for creating a rich look for our buttons in the application. It’s an XML file containing various tags and attributes specifying the properties that the button will have for its appearance.








