What we are going to build in this application?
Step by Step Implementation
Step 1: Create a New Project
- Open a new project.
- We will be working on Empty Activity with language as Java. Leave all other options unchanged.
- Name the application at your convenience.
- There will be two default files named activity_main.xml and MainActivity.java.
If you don’t know how to create a new project in Android Studio then you can refer to How to Create/Start a New Project in Android Studio?
Step 2. Working on the XML file
Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file.
Step 3. Working on HTML file
Navigate to app > new > file and name it as index.html. Use the following code in the index.html file
Step 4. Working on CSS file
Navigate to app > new > file and name it as style.css. Use the following code in the style.css file
Navigate to app > new > file and name it as index.js. Use the following code in the index.js file
Step 6. Working on Java file
Navigate to the MainActivity.java file and use the following code in it.
Here is the final output of our application.