Based on the networking framework of Retrofit and Rxjava2, the builder mode constructs RestClient, encapsulates the request method, supports configuration loading animation, and chain call. Unified request to get the original data returned by the background.
Let's take a look at the network request sample code
Chain c ...
Posted on Fri, 22 May 2020 12:23:59 -0400 by EPCtech
Picasso itself does not "implement" the local cache function, but lets the network request layer cache the http response. Its network request logic corresponds to the implementation of DownLoader interface in Picasso.
compile 'com.squareup.okhttp3:logging-interce ...
Posted on Tue, 05 May 2020 13:56:36 -0400 by rob.weaver
In the face of some nonstandard json, our gson parsing often throws a variety of exceptions that cause the app to crash. Here are some measures to avoid this
I tried some solutions to the array type field parsing exception, but there are problems in the end. If you have a good solution, I hope you can post it below. Thank you very much
Posted on Thu, 30 Apr 2020 04:36:26 -0400 by kporter.porter
In this paper, OkHttp's Interceptor is used to implement a custom number of retries
Although OkHttp has its own retryOnConnectionFailure(true) method to enable retries, it does not support custom retries, so sometimes it does not meet our needs.
#1. Custom retry interceptor:
* Retry Interceptor
public class RetryIntercepter implements ...
Posted on Tue, 28 Apr 2020 13:05:28 -0400 by Pjack125
Here I'm going to talk about Android's common network request library, Retrofit. Retrofit can be regarded as an "upgraded version" of okhttp. Why? That's because its internal default is based on okhttp for encapsulation.
1. baseUlr of retrofit2 must end with / (slash),
Otherwise, an IllegalArgument ...
Posted on Wed, 01 Apr 2020 01:57:19 -0400 by kalebaustin
In practical application development, the commonly used network frameworks are OkHttp, Retrofit, RxJava+RxAndroid, each of which has its own advantages: for example, OkHttp, because of its unique interceptor responsibility chain mode, can intercept requests and responses; Retrofit internally encapsulate ...
Posted on Sat, 07 Mar 2020 23:29:01 -0500 by netman182
stay Android network request framework - Retrofit (dynamic agent mode) This section mainly introduces the use of Retrofit.
1. Advantages of retrofit
API is simple, annotation is highly decoupled, multiple parsers are supported, and RxJava is supported.
After introducing these advantages of Retrof ...
Posted on Thu, 06 Feb 2020 08:43:19 -0500 by pkellum
GitHub address, give Star a hand
It is a simple encapsulation of Retrofit+Okhttp auxiliary class. vesion 1.0.X implements Get, post form and post JSON
There are three forms of network requests, and the subsequent versions will realize file upload and download and various raw requests.
Posted on Fri, 31 Jan 2020 05:10:31 -0500 by lizzardnub
At present, there are many projects that use Retrofit2+LiveData for API requests. Unlike RxJava, LiveData can easily process Error. Therefore, we want to encapsulate a tool class based on LiveData to uniformly process Error/Loading in API requests
open class HttpManager<T>(context ...
Posted on Wed, 29 Jan 2020 11:12:25 -0500 by burnside
1. Dependency library import
2. Basic use
2.1 define request interface
Posted on Thu, 02 Jan 2020 07:29:30 -0500 by sonofsam