[suggestions] Android realizes the perfect packaging of Rxjava2+Retrofit
Learning is like sailing against the current.I learned the basic usage of rxjava and Retrofit last year, but it has not been used in practical projects. This year, we started a new project and decisively introduced rxjava and Retrofit into the new project. This article will introduce the author's encapsulation of Retrofit in the project.Let's t ...
Posted on Mon, 29 Nov 2021 22:44:19 -0500 by shedokan
Retrofit+Rxjava Complete Network Request
A recent project is using this networking, it is very convenient to use, and code management is very convenient. I used studio to add it to grade first
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
compile ...
Posted on Fri, 17 Jul 2020 12:11:06 -0400 by kaos057
Article title: encapsulation of Retrofit2+Rxjava2 network request framework
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 Okhttp3 cache optimization
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.
Configure gradle
compile 'com.squareup.okhttp3:okhttp:3.9.0'
compile 'com.squareup.okhttp3:logging-interce ...
Posted on Tue, 05 May 2020 13:56:36 -0400 by rob.weaver
Handling of the exception of empty string parsing by Gson
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
Excep ...
Posted on Thu, 30 Apr 2020 04:36:26 -0400 by kporter.porter
OkHttp Custom Retry Number
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
Details of Retrofit
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
Android modularization - network module encapsulation
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
Android network request framework -- use of Retrofit
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.
2. use
After introducing these advantages of Retrof ...
Posted on Thu, 06 Feb 2020 08:43:19 -0500 by pkellum
Android network request library RetrofitUtils
RetrofitUtils
GitHub address, give Star a hand
Project introduction
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.
function
Get
Post form
P ...
Posted on Fri, 31 Jan 2020 05:10:31 -0500 by lizzardnub