In the previous article, we have discussed How to create a COVID-19 Tracker Android App which shows only the Global Stats. In this article, we will learn how to create a COVID-19 Tracker Android App which will show the details of any city in any State in India. Details like – Total Active cases, Cured Cases, Deaths, and the total number of confirmed cases of any respective city. Here in this App, let’s track demo of 5 cities and one can change according to his/her needs.
Step 1: Create a New Project
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: Now Add Some Files Before writing the XML and Java Code
- Go to app -> res -> values -> colors.xml section and set the colors for the app.
- These Colors are Used In the apps In various Places.
- Go to Gradle Scripts -> build.gradle (Module: app) section and import the following dependencies and click the “Sync Now” button to Sync the APP.
- To Learn More About Volley Library Click Here.
- Now Go to the app -> manifests -> AndroidManifests.xml section and allow “Internet Permission” because this App will use Internet Permission.
Step 3: Use JSON Parsing to fetch data from the website
- Click on this URL- https://api.covid19india.org/state_district_wise.json
- It will Show Data of the whole Country and in this, We Are Going to fetch data from here Only.
Step 4: Design the Layout of the activity_main.xml
- Go to app -> res -> layout -> activity_main.xml
- Add A TextView To the layout: To display GEEKSFORGEEKS at the top of the screen.
- Add A ListView To the Layout: To display the list of cities tracking details on the screen.
Step 5: Design the Layout for The ListView
- Create A new Layout by right click on the layout folder inside res Folder
- Then Click Layout Resource File and Set the name testing.xml
- Click Finish To save
- Click testing.xml and Start Design UI Layout for the ListView
- The Drawable file used in testing.xml is “arrow upward“. Go to drawable -> New -> Vector Asset and search for “arrow upward” and add it to your file.
Step 6: Create a New JAVA Class to fetch the data we want to fetch from the Website
- Create a new JAVA class name it as Model.java
- Use getters and setters functions to create a function for the data you want to fetch from the website.
Step 7: Create an Adapter Class
Now create a new JAVA Adapter Class to put the data that have fetched into a ListView that has created before.
Step 8: Working with MainActivity.java file
In this file, we are going to use the Volley library. Refer to the comments inside the code to understand the code.
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- How to create a COVID-19 Tracker Android App
- How to Publish Your Android App on Amazon App Store for Free?
- Android | Running your first Android app
- How to create a Facebook login using an Android App?
- How to create a Stopwatch App using Android Studio
- How to create Swipe Navigation in an Android App
- How to create a Face Detection Android App using Machine Learning KIT on Firebase
- How to Create Static Shortcuts in Android App?
- How to Create a Quiz App In Android?
- How to Create a Morse Code Converter Android App?
- How to Create a Basic Widget of an Android App?
- How to Create a Dynamic Widget of an Android App?
- How to Create a Dark Mode for a Custom Android App in Kotlin?
- Android | How to Create/Start a New Project in Android Studio?
- How to create a Circular image view in Android without using any library?
- App Development for Android in 2017: Challenges and Solutions
- How to draw Horizontal and Vertical lines in an Android App using XML
- How to make a phone call from your Android App?
- Why Kotlin will replace Java for Android App Development
- Android | Creating a Calendar View app
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.