Skip to content

Sottti/OkHttp-Retrofit-Moshi-Picasso

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android Networking II: OkHttp, Retrofit, Moshi and Picasso

Java OkHttp Retrofit Moshi Picasso Status

A Java Android sample showing how OkHttp, Retrofit, Moshi, and Picasso fit together in a small networking app.

The app uses Retrofit as the type-safe API layer, Moshi as the JSON converter, OkHttp as the HTTP client underneath Retrofit, and Picasso for image loading and image transformations.

This repository accompanies the article Android Networking II: OkHttp, Retrofit, Moshi and Picasso.

✨ What It Demonstrates

  • A singleton Retrofit client configured with MoshiConverterFactory.
  • Retrofit service interfaces for JSON object and JSON array requests.
  • Call<T> wrappers and asynchronous enqueue() callbacks.
  • Response success/error handling before updating the UI.
  • Request cancellation from onStop().
  • Picasso image loading into ImageView and RecyclerView rows.
  • Placeholder and error images for remote image loading.
  • A custom Picasso Transformation for circular image cropping.
  • Data Binding for simple click handlers and screen bindings.

🖼️ Demo Screens

Screen What It Shows
JsonObjectActivity Fetch one object with Retrofit and render title/body text.
JsonArrayActivity Fetch an array of objects and render multiple parsed items.
ImageLoadingActivity Load a scrolling list of remote images with Picasso.
ImageTransformationActivity Load one image and apply a circular Picasso transformation.

⚙️ Tech Stack

  • Java
  • Android Gradle Plugin 3.0.1
  • Gradle 4.5.1
  • compile SDK 27, target SDK 27, min SDK 16
  • Android Support Library 27.0.2
  • OkHttp 3.9.1
  • Retrofit 2.3.0
  • Moshi 1.5.0
  • Picasso 2.5.2
  • Data Binding
  • RecyclerView and ConstraintLayout

🚀 Run It

This repo is pinned to 2018 Android tooling. For the least friction, use an Android Studio/JDK setup compatible with AGP 3.0.1 and Gradle 4.5.1.

./gradlew :app:assembleLiveDebug
./gradlew :app:installLiveDebug

The sample uses old public demo endpoints and image URLs. If any network call no longer responds, the app still remains useful as a reference for Retrofit, Moshi, Picasso, callbacks, cancellation, and image transformations.

🧪 Verification

No automated test suite is included in this historical sample. The practical sanity check is to build the debug app:

./gradlew :app:assembleLiveDebug

📌 Status

This is a historical sample for an old Android networking article series, not a modern networking template. Its value today is as a compact reference for how OkHttp, Retrofit, Moshi, and Picasso were commonly wired together in a pre-AndroidX Java app.

📜 License

The original README declared this repository to be MIT licensed. A standalone LICENSE file is not currently present in the repository.

About

Historical Java Android networking sample showing OkHttp, Retrofit, Moshi, and Picasso working together.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages