Which of the following is a correct way to create an instance of a Retrofit API interface?
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Để tạo một instance của một interface Retrofit API, bạn cần sử dụng một cách cụ thể. Đầu tiên, bạn cần tạo một đối tượng Retrofit Builder bằng cách sử dụng phương thức new. Sau đó, bạn cần thêm baseUrl và converter factory vào đối tượng này. Cuối cùng, bạn có thể tạo instance của interface Retrofit API bằng phương thức create(). Ví dụ, bạn có thể sử dụng đoạn mã sau: Retrofit retrofit =
new Retrofit.Builder().baseUrl(BASE_URL).addConverterFactory(GsonConverterFactory.create()).build();MyApiEndpointInterface api =
retrofit.create(MyApiEndpointInterface.class);Cùng chương 8
How do you add a query option to a REST web-service call in Retrofit?.Có lời giảiCâu hỏiWhich permission should Android app use when the app wants to track phone's precise location?Có lời giảiCâu hỏiWhich method is called when the map is loaded and ready to be used in the app?Có lời giảiCâu hỏiCả 28 câu của chủ đề28 câu
Đi tiếp từ đây