The introduction

Since I made a fake wechat project with the old MVC last time, I made a short-term plan for myself. I first learned MVP+RxJava+Retrofit, the three new Android sworders. So, after more than a week’s struggle, I finally got into the door of MVP+RxJava+Retrofit. After two years of baptism, the three technologies continue to mature and stable, the majority of the program ape unanimously recognized. There are many excellent articles on the web that cover these three techniques, so this article will serve as a guide to some of the best articles or projects I’ve read while studying the three and lambda expressions.

Let’s get a general idea of the three musketeers:

  • Android teaches you step by step to build MVP+Retrofit+RxJava web request framework

A, RxJava

1. Introduction

1), for the introduction of RxJava, online agreed that the author named “throw line” article is the best, but, RxJava itself for the novice is more difficult to understand, read a is not remember how much, it is recommended to read two times, then will be “read a hundred times, its meaning from”.

  • RxJava for Android developers

2), in addition, the author “Hi big head ghost Hi” translation is also written very good, very reference value:

  • RxJava (1: Basics)
  • RxJava(2: Operator)
  • RxJava 3 – The benefits of responsiveness
  • RxJava 4 – Reactive programming in Android

2. Segmentation:

The so-called subdivision is nothing more than learning RxJava operators and actual use scenarios, the following is recommended by the author “Yu Zhiqiang” article, here hint, the author is using the old version of RxJava, so some methods may be removed in the new version, so we look at the time, do not feel strange.

  • RxJava Create operator usage and source code analysis
  • How to use the RxJava map operator
  • RxJava flatMap operator
  • RxJava concatMap operator
  • 5. RxJava onErrorResumeNext implements the token mechanism between app and server
  • The RxJava retryWhen operator implements the error retry mechanism
  • 7. RxJava optimizes app search using the Debounce operator
  • RxJava concat operations handle multiple data sources
  • The RxJava ZIP operator is used in Android
  • The RxJava switchIfEmpty operator enables Android to check the local cache logic
  • The RxJava defer operator implementation code supports chained calls

3. Others:

RxJava operator (RxJava)

  • RxJava map and flatMap
  • RxJava practical skills

Second, the Retrofit

1. Introduction

To get started with Retrofit, it’s not hard to read the following basics. Here’s a recommended article by The author:

  • Retrofit 2.0 superpractises (1), okHttp supports Https transfer perfectly
  • Retrofit2.0, OkHttp3 perfect synchronization persistent Cookie implementation login free (2)
  • Retrofit 2.0 can easily upload files/multiple images /Json strings
  • Retrofit 2.0 Superpowers (iv), complete download of large file breakpoints
  • Retrofit dynamically adds headers and parameters to each Request (5)
  • Android based on Retrofit2.0 +RxJava package super easy to use RetrofitClient tool class (six)

2. Segmentation:

Persistent cookies, data caching, and Log output will definitely be used in development.

  • How does Retrofit+OKHttp persist cookies
  • Cache processing is implemented using Retrofit2.0+OkHttp3.0
  • Okhttp log interceptor LoggingInterceptor

3, other

Here is a collection of some of the errors I have encountered in use:

  • @Field parameters can only be used with form encoding

Third, the MVP

In a word, see more, it is better to practice. MVP concept is a lot of online search, can also be understood through the above article content, here is not introduced, for MVP learning, I am directly through the code to learn, here recommended a good project example, please learn RxJava and Retrofit on the basis of the end, I believe it will be of great help to you:

  • Practice! A reading App made in my spare time (MVP + RxJava + Retrofit)

Lambda expressions

  • Lambda expressions are used in Android

conclusion

After reading the above article, it is really very helpful for me, I feel that the combination of the three is invincible, but there are still a lot of details that I haven’t met yet, maybe there is a big pit, if there is, I will continue to update in this article. Finally, I wish you Android, Java program monkey into the pit smoothly, hey hey ~.