Covid-19 Tracer is an Android application designed to fetch and display COVID-19 data for various districts in India. The app retrieves data from a public API and presents it in a user-friendly format, helping users stay informed about the pandemic's impact in their region.
- Fetch COVID-19 Data: Retrieves real-time COVID-19 statistics (active, confirmed, deceased, and recovered cases) for districts in India.
- District-Level Data: Focuses on detailed district-wise information for better granularity.
- User-Friendly Interface: Displays data using a clean and simple ListView layout.
- Asynchronous Data Loading: Implements background tasks to fetch data without blocking the user interface.
- Error Handling: Provides feedback in case of data retrieval or parsing errors.
- Clone the repository:
git clone https://github.com/drish1001/Covid-19-Tracer.git
- Open the project in Android Studio.
- Sync Gradle files to download dependencies.
- Build and run the app on an Android device or emulator.
The project uses the following dependencies:
androidx.appcompat:appcompat:1.0.2androidx.constraintlayout:constraintlayout:1.1.3junit:junit:4.12androidx.test.ext:junit:1.1.0androidx.test.espresso:espresso-core:3.1.1
These are managed in the build.gradle file.
-
API Integration:
- The app fetches data from the public API endpoint:
https://api.covid19india.org/state_district_wise.json - The
HttpHandlerclass handles HTTP requests and responses.
- The app fetches data from the public API endpoint:
-
Data Parsing:
- JSON data is parsed to extract district-wise statistics for a specific state (e.g., Rajasthan).
- The
MainActivityclass processes this data and populates it into a list.
-
UI Display:
- A
ListViewdisplays the parsed data using a custom layout (list_item.xml), showing details like active, confirmed, deceased, and recovered cases for each district.
- A
-
Error Handling:
- Displays appropriate messages if there are issues with API connectivity or JSON parsing.
Covid19_tracer/
├── app/
│ ├── src/
│ │ ├── main/
│ │ │ ├── java/com/example/covid_19_tracer/
│ │ │ │ ├── HttpHandler.java # Handles HTTP requests
│ │ │ │ ├── MainActivity.java # Main logic for fetching and displaying data
│ │ │ ├── res/
│ │ │ ├── layout/ # XML layouts (activity_main.xml, list_item.xml)
│ │ │ ├── values/ # Colors, strings, and styles
│ │ │ ├── mipmap/ # App icons
│ ├── build.gradle # Module-level Gradle config
├── build.gradle # Project-level Gradle config
├── gradle.properties # Gradle settings
The app requires the following permissions:
- Internet Access:
<uses-permission android:name="android.permission.INTERNET" />
- Network State Access:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
You can modify the app to fetch data for other states or customize its UI by editing:
- API Endpoint: Update the URL in
MainActivity.java. - UI Layouts: Modify XML files in the
res/layout/directory. - Themes and Colors: Customize colors in
res/values/colors.xmland styles inres/values/styles.xml.
- The app currently focuses on Rajasthan's district-level data by default.
- No offline functionality; requires an active internet connection.
Contributions are welcome! Feel free to open issues or submit pull requests to improve this project.
This project is licensed under the MIT License.
Citations :