The News App is an Android application that provides users with the latest news articles from various sources. It follows the MVVM (Model-View-ViewModel) architecture, allowing for a clean and organized structure. The app utilizes Room for local data storage to save bookmarked news articles, and Retrofit for seamless integration with a news API.
- Browse latest news articles from multiple sources.
- Bookmark interesting articles for later reading.
- Offline access to bookmarked articles using Room database.
- Clean and organized MVVM architecture.
- Seamless integration with a News API using Retrofit.
The app follows the MVVM (Model-View-ViewModel) architecture, which separates the concerns of data, UI, and business logic. The key components include:
-
Model: Represents the data and business logic. In this app, it includes entities for articles, a Room database for local storage, and a repository for managing data.
-
View: Represents the UI components. Activities and Fragments observe data changes from the ViewModel and update the UI accordingly.
-
ViewModel: Acts as a mediator between the Model and the View. It holds and manages UI-related data, providing a clean interface for the UI to interact with the underlying data.
-
MVVM Architecture: Ensures a separation of concerns and a scalable, maintainable codebase.
-
Room: A local database to store bookmarked news articles, providing offline access.
-
Retrofit: A type-safe HTTP client for Android that simplifies API integration.
Follow these steps to set up and run the News App on your local machine:
-
Clone the repository:
git clone https://github.com/your-username/news-app.git
-
Open the project in Android Studio.
-
Build and run the app on an Android emulator or physical device.
The News App requires an API key to access the news API. Obtain an API key from News API by following these steps:
-
Visit News API and sign up for an account.
-
Once registered, obtain your API key from your account dashboard.
-
Add the API key to the
API_KEY
constant in theNewsApiService.kt
file:// NewsApiService.kt const val API_KEY = "your_api_key_here"