androidConsume an API, Web Service with Retrofit on Android
Tutorial to create a Pokédex app from scratch.
Tutorial to create a Pokédex app from scratch. The app uses Retrofit library to consume an API on Android. In addition to using Glide to download images.
What you'll learn
- Consume an API or Web Service with Retrofit
- Use a
RecyclerView
component in grid mode - Handle
RecyclerView
events
What you'll need
Introduction
API (0:22)
Google Chrome Extension (1:10)
Images (1:47)
URL to obtain the images of the pokemon by their number.
~~https://pokeapi.co/media/sprites/pokemon/25.png~~
Update: The previous URL stopped working but you can get the image directly from the repository like this:
https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/25.png
Pikachu is the pokemon number 25.
Retrofit
2:02: Dependency to use Retrofit in the module build.gradle
~~compile 'com.squareup.retrofit2:retrofit:2.1.0'~~
Update: compile
is deprecated and there are new versions.
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
Release numbers, more information and Retrofit documentation:
The master branch was updated with the migration of AndroidX and the update of gradle tools. If you want to see exactly the same version of the video, it is in the video branch.