An Android application for browsing movies and TV shows using The Movie Database (TMDB) API.
This repository contains a native Android app (Java) that demonstrates fetching lists of movies/TV shows, showing details, and basic navigation.
- Browse trending, popular, movies, TV shows and upcoming movies
- View movie details
- Discover movies (discover endpoint)
- Recyclers and adapters for lists and grids
- Language: Java (Android)
- Build system: Gradle
- Minimum setup: Android Studio + JDK
- Android Studio (recommended latest stable)
- JDK 11 or newer (project uses Java Android toolchain)
- Internet connection for API calls
The app uses the TMDB REST API and requires an API key.
Currently the project exposes a default place for the API key in app/src/main/java/com/horizonhunters/tmdb/Connstant.java (not recommended for published repos).
Recommended approaches:
- Local only (preferred): store your key in
local.propertiesand changeConnstantor Gradle to load it from there.- Add to
local.properties(top-level project folder): TMDB_API_KEY=your_api_key_here - Then modify
Connstant.javaor the Gradle build to read from BuildConfig or resources so the key is not checked into source control.
- Add to
- Quick (existing code): replace the value in
Connstant.API_KEYwith your key (only for local development).
Do not commit your API key to a public repository.
- Clone the repository
git clone <your-repo-url> cd TMDB
- Open the project in Android Studio (recommended) or import the Gradle project.
- Provide a TMDB API key using one of the methods above.
- Sync Gradle and build.
- Assemble debug APK:
./gradlew assembleDebug- Install to a connected device/emulator:
./gradlew installDebug- Run unit tests:
./gradlew test- Run instrumented (connected) tests (device required):
./gradlew connectedAndroidTest- app/src/main/java/com/horizonhunters/tmdb/
- Connstant.java — base URL and API key holder (change this for your API key)
- MainActivity.java — app entry and fragment navigation
- Activity/ — Activities such as
MovieDetailsActivity, TV series details, etc. - home/ — Home screen and subpackages (Trending, Popular, Movies, TvSeries, Upcoming)
- movieDiscover/ —
DiscoverMovieFragment,DiscoverMovieAdapter, and model classes for the discover flow - CustomProgressDialog.java — simple loading dialog used across fragments
- app/src/main/res/layout/ — fragment and item layouts (e.g.
fragment_movie_discover.xml,item_discover_poster.xml)
app/src/main/java/com/horizonhunters/tmdb/home/HomeFragment.java— Home screen that fetches multiple lists and includes an auto-scrolling carousel for trending (active in HomeFragment only).app/src/main/java/com/horizonhunters/tmdb/movieDiscover/DiscoverMovieFragment.java— Discover movies fragment. NOTE: recently refactored to matchHomeFragmentfetch style: a single fetch usingCustomProgressDialog, clearing the list then callingnotifyDataSetChanged(). Auto-scrolling / pagination logic was removed per recent change.app/src/main/java/com/horizonhunters/tmdb/movieDiscover/DiscoverMovieAdapter.java— Adapter used by the discover fragment to show poster grid items.
Per a requested change, DiscoverMovieFragment was updated to:
- Remove auto-scrolling and pagination behavior
- Use the same fetch pattern as
HomeFragment: showCustomProgressDialogwhile fetching, clear the list on each fetch, parse results,notifyDataSetChanged()on success This makes the discover screen simpler and consistent with the rest of the app UI code.
If you want pagination or infinite scrolling later, you can reintroduce a scroll listener and progressive loading, or switch to Android Paging 3 library for robust paging.
- Some adapters or classes may have non-critical lint warnings (for example,
notifyDataSetChanged()usage or fields that can befinal). These are warnings and don't stop the build but can be improved.
- Detekt is configured for Kotlin projects; this is a Java project — adjust or skip if not applicable.
- You can still run Gradle lint and other checks provided by Android Studio.
- Fork and create a feature branch
- Make changes and run local tests
- Open a pull request with a clear description
- Network errors: ensure your device/emulator can access the internet and your API key is valid.
- If you see JSON parsing errors, check the logs (Logcat) for the request URL and the raw JSON response.
This project uses the MIT license. Replace with the correct license if different.
If you want, I can:
- Add a short section with exact code snippets to read the API key from
local.propertiesvia Gradle/BuildConfig and updateConnstantto read from BuildConfig (recommended). I can implement that change and a small migration guide. - Run a full Gradle build in this environment and report results.
Which follow-up would you like?