RxJava2 and Retrofit2 encapsulation (neat, simple, practical)

RxJava2 and Retrofit2 are old partners. Previously, I wrote a "unified processing of single request by RxJava and Retrofit2", which is Rxjava1.0. This time, Rxjava2.0 and Retrofit2 are used for encapsulation, which is clean, simple and practical. Compared with Rxjava1, RxJava2 optimizes and changes many things. There are ...

Posted by phpmixx on Wed, 11 Dec 2019 07:20:10 -0800

Retrofit2.0 set connection timeout

Retrofit2.0, a network request framework, has been in use for a long time. Recently, there was an episode. There is an interface that returns a large amount of data due to business reasons. When the network is not good, the request fails That is to say, the onfailure() method is called back. After testing, the method will be called back in abou ...

Posted by exally on Sun, 08 Dec 2019 18:47:34 -0800

Coroutines in Android - One Shot and Multiple Values

In Android, the data we use may be one-time or multiple values This paper introduces how to deal with these two situations with MVVM mode of coroutines in Android. It focuses on the application of coroutine Flow in Android One-shot vs multiple values The data used in practical application may be one shot, multiple values, or stream For example, ...

Posted by itguysam on Sun, 08 Dec 2019 01:50:03 -0800

Flutter develops the Dio interceptor to realize the function of token verification expiration

Preface: Before, I shared the solution of using Retrofit to refresh token invalidation in Android. Now the Flutter project also has the requirement of "token verification is overdue". So I will briefly summarize how to implement the interceptor function of automatically refreshing token and resending request in the Flutter project, h ...

Posted by implications on Mon, 25 Nov 2019 09:23:33 -0800

About the use of config.gradle

Last night, I read this article and mentioned config.gradle, such a configuration, so today I found a DEMO to try, record and summarize it. This diagram is a directory structure   config.gradle--project ext { android = [ compileSdkVersion: 28, buildToolsVersion: "28 ...

Posted by maya28 on Thu, 31 Oct 2019 08:50:07 -0700

Retrofit custom Converter implements sending String and receiving JSON

Retrofit has provided users with six converters, as follows: Gson: com.squareup.retrofit2:converter-gson Jackson: com.squareup.retrofit2:converter-jackson Moshi: com.squareup.retrofit2:converter-moshi Protobuf: com.squareup.retrofit2:converter-protobuf Wire: com.squareup.retrofit2:con ...

Posted by Spear Chucka on Sat, 26 Oct 2019 12:05:05 -0700

RxJava 2 + Retrofit 2 in combination

Instead of rxjava and retrofit, I'm going to go straight to 2, because 2 encapsulates better and more useful. 1. Observer model For example, a common button click event is that a button is an observer, a listener is an observer, and a setOnClickListener process is a subscription. With a subscription relationship, when a button is clicked, the l ...

Posted by tha_mink on Mon, 30 Sep 2019 19:02:05 -0700

Failure Solution for adapter.notifyDataSetChanged()

Speaking of this method, I believe that almost every touch of Android development has been used, but many times it is not our wrong use, but inadvertently caused us. Notfy DataSetChanged () suddenly lost its effect, let us feel confused. Here are three solutions based on our own experience in using. Law. 1. The data source is not updated and ...

Posted by psytae on Wed, 17 Jul 2019 14:52:19 -0700

Android Wechat Payment Trample Record

First of all, Tucao, WeChat's documents and WeChat's demo are really miserable. It took a long time to get it done. If there are still problems, please check carefully whether the parameters are correct or not. 1. The first step is to obtain the application's MD5 signature information. If you do not configure keytool environments, you ca ...

Posted by ridster on Mon, 08 Jul 2019 13:50:56 -0700

How to use Retrofit (KAD21) with Kotlin on Android

Authors: Antonio Leiva Time: Apr 18, 2017 Link to the original text: https://antonioleiva.com/retrofit-android-kotlin/     This is another example of how to use the same library Java used in Kotlin.     Retrofit is a library that greatly simplifies the request API. In this example, I plan to teach you how to integrate it with some LastFM API r ...

Posted by Fusioned on Sat, 06 Jul 2019 15:57:47 -0700