An Android app to search weather by city name and display maps and real‑time weather info (city, country, description, temperature).
- Search cities using the OpenWeather API
- Display multiple matches as a list: city, country, description, temperature
- Temperature unit conversion (°C / °F) with optional trailing zeros
- Material + Card UI; light/dark theme support
- Language: Java
- minSdk 26 / targetSdk 33
- Gradle 7.4, Android Gradle Plugin 7.3.1
- UI: AppCompat, Material Components, ConstraintLayout, RecyclerView, CardView
- Networking:
HttpURLConnectionon a background thread (HandlerThread/Handler)
app/
├─ src/main/
│ ├─ java/edu/northeastern/weatherfinder/
│ │ ├─ MainActivity.java // Entry screen, navigates to search
│ │ ├─ WeatherSearchActivity.java // City search, HTTP request, JSON parsing
│ │ ├─ CityWeatherListFragment.java // Fragment showing the result list
│ │ ├─ CityWeatherListAdapter.java // RecyclerView adapter
│ │ └─ Weather.java // Weather data model
│ ├─ res/layout/
│ │ ├─ activity_main.xml // Home layout
│ │ ├─ activity_weather_search.xml // Search screen layout
│ │ ├─ fragment_city_weather_list.xml // Result list layout
│ │ └─ city_weather_item.xml // Row item layout
│ ├─ res/values/strings.xml // Strings and API key placeholder
│ └─ AndroidManifest.xml // Permissions & activities
└─ build.gradle // Module configuration
- Android Studio (Hedgehog or newer recommended)
- JDK 11 (compatible with AGP 7.3.1)
- Android SDK 33
-
Clone the repo and open it in Android Studio
-
Configure your OpenWeather API key (required)
- Option A (quick start): set your key in
app/src/main/res/values/strings.xmlforapiKey. - Option B (recommended): inject the key at build time via
gradle.properties/local.propertiesand read it fromBuildConfigor manifest placeholders. The current project uses the string resource approach; feel free to switch as an improvement.
OpenWeather: https://openweathermap.org/api
- Connect a device or start an emulator, then build and run
- Android Studio: Run ▶
- CLI:
./gradlew assembleDebug
The APK will be in app/build/outputs/apk/debug/.
INTERNET,ACCESS_NETWORK_STATEfor network access (seeapp/src/main/AndroidManifest.xml).
- MainActivity navigates to the search screen
- WeatherSearchActivity:
- Reads the city input and performs a background HTTP request
- Builds the OpenWeather URL with locale (
lang) and API key - Parses the JSON response and extracts the city list
- Shows the results in
CityWeatherListFragment
- CityWeatherListFragment converts JSON to a list of
Weatherobjects and binds a RecyclerView - CityWeatherListAdapter renders city, description, temperature with unit formatting
- UnitConvertor provides temperature/rainfall conversions
- Endpoint:
https://api.openweathermap.org/data/2.5/find?q={city}&lang={locale}&mode=json&appid={API_KEY} - Language: uses the device language for the
langparameter (Locale.getDefault().getLanguage())
| Home Map | Card View | Detailed Info |
|---|---|---|
![]() |
![]() |
![]() |
- Replace
HttpURLConnectionwith OkHttp/Retrofit and a cleaner async model - Inject the API key at build time to avoid storing it in
strings.xml - Better error/empty/offline/loading states and retry
- Favorites/recent searches, pull‑to‑refresh
- Unit and UI tests for parsing and conversions
- license (MIT/Apache‑2.0, etc.).


