filmov
tv
Retrofit - Send a simple GET Request | Android Studio Tutorial
Показать описание
🏆 My Online Courses
⭐Discount Coupon: LAUNCH-STEVDZA-SAN
🐱👤 Wanna become a member? Join!
📸 Instagram
Retrofit is a Type Safe REST client for Android Developed by square. It uses okHttp library for HTTP requests, and it's one of the best tools for performing network requests in android applications. In this video I'll show you how to send a simple GET request, receive a result in JSON, convert it to Kotlin object and display it back in our app. So with this video I'm starting a new short tutorial series about Retrofit library, so stay tuned!
Retrofit requires three main components:
1. Retrofit Instance:
We can create an instance of Retrofit by Retrofit.Builder class. And we have to specify the base url and converter factory at the time of the Retrofit instance creation
2. Model Class:
Retrofit needs a Model class for sending and receiving Request. It uses the model class for parsing server Response by using converters like Gson, Moshi etc.
3. An Interface for possible API calls:
The interface contains methods that represents possible API calls. Each methods need a base Url end point annotation that represents the Http methods like GET, POST etc.
Timestamps:
0:00 - Introduction
1:12 - Create Model class
2:28 - Create SimpleApi interface
3:15 - Create Constants class
3:53 - Create RetrofitInstance object (Singleton)
5:02 - Create Repository
5:43 - Create MainViewModel class
6:46 - Create MainViewModelFactory class
7:25 - Implement the logic
9:29 - Handle Exceptions
⭐Discount Coupon: LAUNCH-STEVDZA-SAN
🐱👤 Wanna become a member? Join!
Retrofit is a Type Safe REST client for Android Developed by square. It uses okHttp library for HTTP requests, and it's one of the best tools for performing network requests in android applications. In this video I'll show you how to send a simple GET request, receive a result in JSON, convert it to Kotlin object and display it back in our app. So with this video I'm starting a new short tutorial series about Retrofit library, so stay tuned!
Retrofit requires three main components:
1. Retrofit Instance:
We can create an instance of Retrofit by Retrofit.Builder class. And we have to specify the base url and converter factory at the time of the Retrofit instance creation
2. Model Class:
Retrofit needs a Model class for sending and receiving Request. It uses the model class for parsing server Response by using converters like Gson, Moshi etc.
3. An Interface for possible API calls:
The interface contains methods that represents possible API calls. Each methods need a base Url end point annotation that represents the Http methods like GET, POST etc.
Timestamps:
0:00 - Introduction
1:12 - Create Model class
2:28 - Create SimpleApi interface
3:15 - Create Constants class
3:53 - Create RetrofitInstance object (Singleton)
5:02 - Create Repository
5:43 - Create MainViewModel class
6:46 - Create MainViewModelFactory class
7:25 - Implement the logic
9:29 - Handle Exceptions
Комментарии